Skip to content

Update syntax in reusable build workflow #16

Update syntax in reusable build workflow

Update syntax in reusable build workflow #16

Workflow file for this run

# Description: this workflow publishes UI packages to `latest` tag on NPM.
#
# Triggered by: whenever a PR is merged to `hotfix` branch
# If successful, we will publish all updated UI packages to NPM.
name: POC Test and Publish / hotfix
on:
push:
# TODO
# branches: [hotfix]
branches: [rn-log-build-system]
permissions:
id-token: write # This is required for requesting the JWT
contents: write # Used to push tags to GitHub
jobs:
setup:
runs-on: ubuntu-latest
outputs:
has-changesets: ${{ steps.has-changesets.outputs.has-changesets }}
steps:
- name: Checkout repo
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Check if repo has unconsumed changesets
id: has-changesets
uses: ./.github/actions/has-changesets
publish-hotfix:
# TODO
if: false
needs: [setup]
uses: ./.github/workflows/reusable-tagged-publish.yml
with:
dist-tag: hotfix
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
build-test:
runs-on: ubuntu-latest
needs: publish-hotfix
environment: ci
# TODO
if: false
# if: ${{ needs.setup.outputs.has-changesets != 'true' }}
steps:
- name: Checkout repo
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Setup Node.js 20
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: 20
cache: 'yarn'
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Add Amplify CLI
run: yarn global add @aws-amplify/cli
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 https://github.com/aws-actions/configure-aws-credentials/commit/e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: us-east-2
role-to-assume: ${{ secrets.AUTH_E2E_ROLE_ARN }}
# Amplify CLI does not support headless pull with temporary credentials
# when useProfile is false.
# See: https://github.com/aws-amplify/amplify-cli/issues/11009.
- name: Create temp AWS profile
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Pull down AWS environments
run: yarn pull
working-directory: ./canary
- name: Delete AWS Profile
run: rm -rf ~/.aws
- name: Setup canary apps against @hotfix
run: yarn setup:hotfix
working-directory: ./canary
- name: Run yarn install on each sample app
run: yarn install
working-directory: ./canary
- name: Run yarn build on each sample app
run: yarn build
working-directory: ./canary
build-react-native:
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
needs: setup
with:
dist-tag: hotfix
publish:
runs-on: ubuntu-latest
environment: deployment
needs:
- build-test
- build-react-native
# TODO
# if: ${{ needs.setup.outputs.has-changesets != 'true' }}
if: false
steps:
- name: Fake Publish
run: echo "Fake Publish to latest"
# - name: Checkout repo
# uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
# with:
# # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
# fetch-depth: 0
# - name: Setup Node.js 20
# uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
# with:
# node-version: 20
# cache: 'yarn'
# env:
# SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
# - name: Install packages
# uses: ./.github/actions/install-with-retries
# with:
# skip-cypress-binary: true # publishing doesn't need cypress
# - name: Build packages
# run: yarn build
# - name: Publish to @latest
# uses: changesets/action@b98cec97583b917ff1dc6179dd4d230d3e439894
# with:
# publish: yarn publish:latest
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
log-failure-metric:
# Send a failure data point to metric PublishLatestFailure in github-workflows@ us-east-2
runs-on: ubuntu-latest
environment: ci
needs: publish
# TODO
if: false
# if: ${{ failure() }}
steps:
- name: Log failure data point to metric PublishLatestFailure
run: echo "Log failure data point to metric PublishLatestFailure"
# uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
# with:
# metric-name: PublishLatestFailure
# value: 1
# role-to-assume: ${{ secrets.METRIC_LOGGER_ROLE_ARN }}
# aws-region: us-east-2
log-success-metric:
# Send a success data point to metric PublishLatestFailure in github-workflows@ us-east-2
runs-on: ubuntu-latest
environment: ci
needs: publish
# TODO
if: false
# if: ${{ success() }}
steps:
- name: Log success data point to metric PublishLatestFailure
run: echo "Log success data point to metric PublishLatestFailure"
# uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
# with:
# metric-name: PublishLatestFailure
# value: 0
# role-to-assume: ${{ secrets.METRIC_LOGGER_ROLE_ARN }}
# aws-region: us-east-2