Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release workflow #4187

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
61 changes: 59 additions & 2 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
NyanKiyoshi marked this conversation as resolved.
Show resolved Hide resolved
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-latest
NyanKiyoshi marked this conversation as resolved.
Show resolved Hide resolved
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@v1
NyanKiyoshi marked this conversation as resolved.
Show resolved Hide resolved
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 }}"
}
}'