Skip to content

Commit

Permalink
Update release workflow (#4187)
Browse files Browse the repository at this point in the history
* Update relase workflow

* Workflow update

* Changesets

* Ubuntu version

* Aws actions update
  • Loading branch information
andrzejewsky authored Sep 18, 2023
1 parent 2055b25 commit 671ab2b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-ties-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Update workflow to be compatible with changesets
63 changes: 60 additions & 3 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
prepare:
name: Prepare release with Changesets
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
published: ${{ steps.changesets.outputs.published }}
permissions:
contents: write
pull-requests: write
Expand All @@ -24,7 +26,7 @@ jobs:
node-version-file: ".nvmrc"
- name: Install Dependencies
run: npm ci
- name: Create Release Pull Request
- name: Publishing version
uses: changesets/action@d89c1de63c7f28ac47ec85ed395f5f1d045d4697 # v1.4.4
id: changesets
with:
Expand All @@ -33,3 +35,58 @@ jobs:
publish: "npm run release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Deploy and release to sandbox
needs: changesets
if: needs.prepare.outputs.published == 'true'
runs-on: ubuntu-22.04
env:
API_URI: /graphql/
APP_MOUNT_URI: /dashboard/
STATIC_URL: /dashboard/static/
SENTRY_ORG: saleor
SENTRY_PROJECT: dashboard
SENTRY_URL_PREFIX: "~/dashboard/static"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
APPS_MARKETPLACE_API_URI: "https://apps.staging.saleor.io/api/v2/saleor-apps"
VERSION: ${{ github.event.inputs.git_ref || github.ref_name }}
IS_CLOUD_INSTANCE: true
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install Dependencies
run: npm ci
- name: Build
run: |
npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_DASHBOARD_STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DASHBOARD_STAGING_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy
run: |
aws s3 sync build/dashboard s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/${ENVIRONMENT}/static/
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/${ENVIRONMENT}/
for i in {1..3}; do aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*" && break || sleep 5; done
- name: Prepare Sandbox release pull request
run: |
export GITHUB_TOKEN=$( \
curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \
)
gh api /repos/saleor/saleor-cloud-deployments/dispatches \
--input - <<< '{
"event_type": "open-release-pull-request",
"client_payload": {
"project": "DASHBOARD",
"environment": "SANDBOX",
"version": "${{ github.ref_name }}"
}
}'

0 comments on commit 671ab2b

Please sign in to comment.