Skip to content

Commit

Permalink
Update build.yaml and release.yaml workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Apr 25, 2024
1 parent 67f4000 commit 53f727f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- os: macos-latest
python-version: '3.11'
target: macos-x86
runs-on: [self-hosted, macOS]
runs-on: macos-latest
- os: ubuntu-latest
python-version: '3.11'
target: linux
runs-on: ubuntu-latest
- os: windows-latest
python-version: '3.11'
target: windows
runs-on: [self-hosted, Windows]
runs-on: windows-latest

runs-on: ${{ matrix.runs-on }}

Expand Down
50 changes: 6 additions & 44 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# only run this workflow on the main branch and when a tag is pushed
# this workflow will create a release draft and upload the build artifacts
# only run this workflow on the main branch.
# when a tag is pushed this workflow will create a release draft and upload the build artifacts
# to the release draft
name: Release
run-name: ${{ github.ref_name }} release run 🚀
Expand All @@ -17,7 +17,6 @@ concurrency:
jobs:
build-project:
name: Build Project 🧱
if: github.ref_type == 'tag'
uses: ./.github/workflows/build.yaml
secrets: inherit
permissions:
Expand Down Expand Up @@ -96,49 +95,12 @@ jobs:
done
done
- name: Create Latest Release Info File
- name: Upload Release Artifacts 📤
if: fromJSON(steps.check.outputs.validTag)
run: |
echo "LATEST_RELEASE_TAG=${GITHUB_REF_NAME}" > release_info.env
echo "LATEST_COMMIT_HASH=${GITHUB_SHA}" >> release_info.env
echo "LATEST_RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> release_info.env
cp release_info.env "$(pwd)/uploads/release_info.env"
- name: Upload to S3 📤
if: fromJSON(steps.check.outputs.validTag)
uses: shallwefootball/s3-upload-action@master
uses: actions/upload-artifact@v4
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.AWS_BUCKET }}
source_dir: './uploads/'
destination_dir: ''

- name: Create a release note on Shopify
if: fromJSON(steps.check.outputs.validTag)
run: |
: Create a release note on Shopify
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
echo "Creating a release note on Shopify"
echo "Get the blog id from Shopify"
BLOG_ID=$(curl -s -X GET "https://${{ secrets.SHOPIFY_STORE_ID }}.myshopify.com/admin/api/2024-01/blogs.json" \
-H 'Content-Type: application/json' \
-H "X-Shopify-Access-Token: ${{ secrets.SHOPIFY_ACCESS_TOKEN }}" | jq ".blogs[0].id")
echo "Blog ID: ${BLOG_ID}"
if [ -z "${BLOG_ID}" ] || [ "${BLOG_ID}" == "null" ]; then
echo "Blog ID is empty"
exit 1
fi
PUBLISHED_AT=$(date -u +"%a %b %d %T %Z %Y")
echo "Create a new article on Shopify"
curl -s -X POST "https://${{ secrets.SHOPIFY_STORE_ID }}.myshopify.com/admin/api/2024-01/blogs/${BLOG_ID}/articles.json" \
-H 'Content-Type: application/json' \
-H "X-Shopify-Access-Token: ${{ secrets.SHOPIFY_ACCESS_TOKEN }}" \
-d "{\"article\": {\"title\": \"New Release: ${GITHUB_REF_NAME}\",\"author\": \"ScoreSight\",\"tags\": \"release\",\"published_at\": \"${PUBLISHED_AT}\",\"body_html\": \"<p>Version: ${GITHUB_REF_NAME}</p><p>Bugfixes, features and improvements.</p><p>Release Date: ${PUBLISHED_AT}</p>\"}}"
echo "Release note created on Shopify"
name: scoresight-${GITHUB_REF_NAME}
path: uploads

# - name: Generate Checksums 🪪
# if: fromJSON(steps.check.outputs.validTag)
Expand Down

0 comments on commit 53f727f

Please sign in to comment.