Skip to content

Updates for project Merchant Center Applications (#3510) #1626

Updates for project Merchant Center Applications (#3510)

Updates for project Merchant Center Applications (#3510) #1626

Workflow file for this run

name: Release
on:
push:
branches:
- main
permissions:
id-token: write
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
# Get GitHub token via the CT Changesets App
- name: Generate GitHub token (via CT Changesets App)
id: generate_github_token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.CT_CHANGESETS_APP_ID }}
private_key: ${{ secrets.CT_CHANGESETS_APP_PEM }}
- name: Checkout
uses: actions/checkout@v4
with:
# Pass a personal access token (using our `ct-changesets` app) to be able to trigger other workflows
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ steps.generate_github_token.outputs.token }}
- name: Installing dependencies and building packages
uses: ./.github/actions/ci
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
provenance=true
email=npmjs@commercetools.com
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Storing release version for changeset
id: release_version
run: echo "VALUE=$(./scripts/print_release_version.sh)" >> $GITHUB_OUTPUT
shell: bash
env:
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
- name: Creating release pull request or publishing release to npm registry
id: changesets
# uses: changesets/action@v1.3.0
uses: dotansimha/changesets-action@v1.5.2
with:
publish: pnpm changeset publish
version: pnpm changeset:version-and-format
commit: 'ci(changesets): version packages'
createGithubReleases: aggregate
githubReleaseName: v${{ steps.release_version.outputs.VALUE }}
githubTagName: v${{ steps.release_version.outputs.VALUE }}
env:
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
SKIP_POSTINSTALL_DEV_SETUP: true
# Publish canary releases only if the packages weren't published already
- name: Publishing canary releases to npm registry
if: steps.changesets.outputs.published != 'true' && github.ref == 'refs/heads/main'
run: |
git checkout main
pnpm changeset version --snapshot canary
pnpm changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
- name: Building Playground application
if: steps.changesets.outputs.published != 'true' && github.ref == 'refs/heads/main'
run: pnpm playground:build
env:
APP_ID: ${{ secrets.APP_ID_PLAYGROUND }}
MC_API_URL: ${{ secrets.MC_API_URL }}
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }}
HOST_GCP_STAGING: ${{ secrets.HOST_GCP_STAGING }}
- name: Deploying Playground application to Vercel (production)
if: steps.changesets.outputs.published != 'true' && github.ref == 'refs/heads/main'
run: |
pnpm --filter @commercetools-local/playground run deploy --prod --token="${{ secrets.VERCEL_TOKEN_PLAYGROUND }}"
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_PLAYGROUND }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_PLAYGROUND }}