fix: wrong workflows and npm token #12
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: Publish ExaForce image | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "**-exaforce" | |
| workflow_dispatch: | |
| # These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| PUSH: ${{ github.event_name != 'pull_request' }} | |
| jobs: | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Needed for npm provenance | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| registry-url: https://registry.npmjs.org/ | |
| - run: npm ci | |
| env: | |
| GITHUB_NPM_REGISTRY_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - run: npx playwright install --with-deps | |
| - run: npm run build | |
| - run: npm run lint | |
| - run: npm run ctest | |
| publish-docker: | |
| name: Publish to Docker | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: publish-npm | |
| steps: | |
| - name: Checkout playwright | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::157206707803:role/github-actions-ExaForce-operations | |
| aws-region: us-east-2 | |
| mask-aws-account-id: "false" | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| mask-password: "false" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.0.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.3.0 | |
| - name: Set SHA env | |
| run: echo "GITHUB_SHA_SHORT=$(echo ${{ github.event.pull_request.head.sha || github.sha }} | cut -c 1-8)" >> $GITHUB_ENV | |
| - name: Sanitize branch name | |
| run: echo "SANITIZED_BRANCH_NAME=$(echo ${{ github.ref_name }} | tr '/' '_')" >> $GITHUB_ENV | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| file: Dockerfile | |
| push: ${{ env.PUSH }} | |
| tags: 157206707803.dkr.ecr.us-east-2.amazonaws.com/playwright:${{ env.SANITIZED_BRANCH_NAME }}-${{ env.GITHUB_SHA_SHORT }} , 157206707803.dkr.ecr.us-east-2.amazonaws.com/playwright:${{ env.SANITIZED_BRANCH_NAME }}-latest | |
| platforms: "linux/arm64" | |
| secrets: | | |
| npm_token=${{ secrets.GITHUB_TOKEN }} |