From 70c60fe7dd55b669410b32d25cf3096f31e27f52 Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Fri, 27 Oct 2023 15:16:12 -0500 Subject: [PATCH] chore: Setup v5 LTS CI infrastructure (#12455) --- .../callable-npm-publish-lts-release.yml | 52 +++++++++++++++++++ .../workflows/callable-npm-publish-preid.yml | 2 +- .github/workflows/push-lts-release.yml | 25 +++++++++ package.json | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/callable-npm-publish-lts-release.yml create mode 100644 .github/workflows/push-lts-release.yml diff --git a/.github/workflows/callable-npm-publish-lts-release.yml b/.github/workflows/callable-npm-publish-lts-release.yml new file mode 100644 index 00000000000..b4db35ab829 --- /dev/null +++ b/.github/workflows/callable-npm-publish-lts-release.yml @@ -0,0 +1,52 @@ +name: Release LTS version to npm and update repository + +on: + workflow_call: + inputs: + target: + required: true + type: string + +jobs: + deploy: + name: Publish to Amplify Package + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f + 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: Run npm publish + uses: ./amplify-js/.github/actions/npm-publish + with: + target: ${{ inputs.target }} + npm_token: ${{ secrets.NPM_TOKEN }} + github_user: ${{ vars.GH_USER}} + github_email: ${{ vars.GH_EMAIL}} + + - name: Set github commit user + env: + GITHUB_EMAIL: ${{ vars.GH_EMAIL }} + GITHUB_USER: ${{ vars.GH_USER }} + run: | + git config --global user.email $GITHUB_EMAIL + git config --global user.name $GITHUB_USER + + - name: Update API documentation + working-directory: ./amplify-js + run: | + yarn run docs + git add ./docs/api/ + git commit -m "chore(release): update API docs [ci skip]" + + - name: Push post release changes + working-directory: ./amplify-js + env: + TARGET_BRANCH: ${{ inputs.target }} + run: | + git push origin $TARGET_BRANCH diff --git a/.github/workflows/callable-npm-publish-preid.yml b/.github/workflows/callable-npm-publish-preid.yml index 8d3af4fbc7c..6152f46f331 100644 --- a/.github/workflows/callable-npm-publish-preid.yml +++ b/.github/workflows/callable-npm-publish-preid.yml @@ -22,7 +22,7 @@ jobs: ALLOW_PROTECTED_PREIDS: ${{ inputs.allow-protected-preid }} PREID: ${{ inputs.preid }} FORBIDDEN_PREIDS: latest - PROTECTED_PREIDS: next unstable + PROTECTED_PREIDS: next unstable stable-5 stable-4 run: | echo "Testing to see if $PREID is in the forbidden list ($FORBIDDEN_PREIDS)" for e in $FORBIDDEN_PREIDS; do [[ $PREID == $e ]] && echo "$PREID is forbidden from preid release" && exit 1; done diff --git a/.github/workflows/push-lts-release.yml b/.github/workflows/push-lts-release.yml new file mode 100644 index 00000000000..00704ba053a --- /dev/null +++ b/.github/workflows/push-lts-release.yml @@ -0,0 +1,25 @@ +name: Push - release from LTS branch to LTS dist tag + +concurrency: + # group name unique for push to push-latest-release + group: push-lts-release-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - v5-stable + +jobs: + e2e: + secrets: inherit + uses: ./.github/workflows/callable-release-verification.yml + release: + needs: + - e2e + permissions: + contents: write + secrets: inherit + uses: ./.github/workflows/callable-npm-publish-lts-release.yml + with: + target: v5-stable # TODO Update this to support other LTS branches in the future diff --git a/package.json b/package.json index c4644806578..4b6630f6291 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "publish:main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=unstable --preid=unstable${PREID_HASH_SUFFIX} --exact --no-verify-access", "publish:next": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=next --preid=next${PREID_HASH_SUFFIX} --exact --no-verify-access", "publish:release": "lerna publish --conventional-commits --yes --message 'chore(release): Publish [ci skip]' --no-verify-access", + "publish:v5-stable": "lerna publish --conventional-commits --yes --dist-tag=stable-5 --message 'chore(release): Publish [ci skip]' --no-verify-access", "publish:verdaccio": "lerna publish --no-push --canary minor --dist-tag=unstable --preid=unstable --exact --force-publish --yes --no-verify-access", "ts-coverage": "lerna run ts-coverage" },