Skip to content

chore(deps): dependency cleanup (#14743) #21

chore(deps): dependency cleanup (#14743)

chore(deps): dependency cleanup (#14743) #21

name: Release Latest
# Permissions required for creating git tags and pushing changes
permissions:
contents: write
pull-requests: write
# Prevent concurrent releases to avoid race conditions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
on:
push:
branches:
- main
jobs:
# Job 1: Check if there are unconsumed changesets
setup:
runs-on: ubuntu-latest
outputs:
has-changesets: ${{ steps.has-changesets.outputs.has-changesets }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Check if repo has unconsumed changesets
id: has-changesets
uses: ./.github/actions/has-changesets
# Note: if there are no changesets, that means either
# (1) "Version Packages" PR was just merged, or
# (2) no commits with changesets have been merged after packages were last published.
#
# In either case, we'll attempt to publish the packages. In case of (1), publish will succeed. In
# case of (2), `@changesets/action` will know that packages have already been published and will
# skip publish.
# Job 2: Run release verification tests on every commit
release-verification:
secrets:
GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }}
CYPRESS_GOOGLE_CLIENTID: ${{ secrets.CYPRESS_GOOGLE_CLIENTID }}
CYPRESS_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_GOOGLE_CLIENT_SECRET }}
CYPRESS_GOOGLE_REFRESH_TOKEN: ${{ secrets.CYPRESS_GOOGLE_REFRESH_TOKEN }}
uses: ./.github/workflows/callable-release-verification.yml
# Job 3: Publish packages after all tests pass (only when there are no changesets)
publish:
runs-on: ubuntu-latest
needs: [setup, release-verification]
if: github.repository_owner == 'aws-amplify' && needs.setup.outputs.has-changesets != 'true'
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-js
token: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }}
fetch-depth: 0
- name: Setup node and build the repository
uses: ./amplify-js/.github/actions/node-and-build
- name: Publish to @latest
id: changesets
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
cwd: ./amplify-js
publish: yarn publish:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Job 4: Update local API documentation after successful publish
update-local-docs:
if: needs.publish.outputs.published == 'true'
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-js
token: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }}
- name: Setup node and build the repository
uses: ./amplify-js/.github/actions/node-and-build
- name: Generate API documentation
working-directory: ./amplify-js
run: yarn run docs
- name: Set github commit user
working-directory: ./amplify-js
env:
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
GITHUB_USER: ${{ vars.GH_USER }}
run: |
git config user.email "$GITHUB_EMAIL"
git config user.name "$GITHUB_USER"
- name: Commit and push docs
working-directory: ./amplify-js
run: |
git add ./docs/api/
git commit -m "chore(release): Update API docs [skip release]" || echo "No changes to commit"
git push origin main
# Job 5: Update external documentation repository
update-external-docs:
needs: update-local-docs
secrets:
GH_TOKEN_AMPLIFY_JS_WRITE: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }}
uses: ./.github/workflows/callable-docs-update.yml