Merge pull request #3641 from Shopify/jh_discount-function-settings-o… #479
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy | |
| on: | |
| push: | |
| branches: | |
| # Stable version branches | |
| - 2023-04 | |
| - 2023-07 | |
| - 2023-10 | |
| - 2024-01 | |
| - 2024-04 | |
| - 2024-07 | |
| - 2024-10 | |
| - 20[0-9][0-9]-[01][1470] | |
| # RC version branches | |
| - 20[0-9][0-9]-[01][1470]-rc | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| changesets: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }} | |
| - uses: ./.github/workflows/actions/prepare | |
| - name: Update npm to latest | |
| run: npm install -g npm@latest | |
| - id: changesets | |
| name: Create release Pull Request or publish to NPM | |
| uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3 | |
| with: | |
| title: Version Packages (${{ github.ref_name }}) | |
| publish: yarn run deploy ${{ !endsWith(github.ref_name, '-rc') && format('--tag {0}', github.ref_name) || '' }} # no tag for RC branches. | |
| createGithubReleases: false | |
| env: | |
| NPM_TOKEN: '' # Forces OIDC authentication | |
| GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }} | |
| # Known to fail in OIDC (https://github.com/npm/cli/issues/8547). | |
| # Workaround is to manually ask #help-eng-infrastructure to update `latest` tag. | |
| - name: Set 'latest' NPM dist tag | |
| if: steps.changesets.outputs.published == 'true' && github.ref_name == vars.LATEST_STABLE_VERSION | |
| env: | |
| PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
| run: | | |
| for pkg in $(echo "$PUBLISHED_PACKAGES" | jq -r '.[] | @base64'); do | |
| _jq() { | |
| echo ${pkg} | base64 --decode | jq -r ${1} | |
| } | |
| npm dist-tag add $(_jq '.name')@$(_jq '.version') latest | |
| done |