GH release-image workflow fixes #2
This file contains 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: Release Image | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build-scip-typescript: | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Authenticate to AWS | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-west-2 | |
role-to-assume: arn:aws:iam::970625735569:role/GitHubActionsECRPush | |
- name: Configure AWS Docker Auth | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: GitHub context | |
run: | | |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Generate OCI Metadata | |
id: image-metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: public.ecr.aws/edgebitio/scip-typescript | |
tags: | | |
type=sha, | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
- name: Build Image | |
id: build | |
uses: docker/build-push-action@v4 | |
with: | |
file: "Dockerfile" | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.image-metadata.outputs.tags }} | |
push: true | |
- name: Generate SBOM from the container | |
uses: anchore/sbom-action@v0 | |
with: | |
image: ${{ steps.build.outputs.imageid }} | |
artifact-name: sbom.spdx.json | |
output-file: /tmp/sbom.spdx.json | |
# This currently points to the Sandbox project | |
- name: Upload SBOM to EdgeBit | |
uses: edgebitio/edgebit-build@main | |
with: | |
edgebit-url: https://edgebit.edgebit.io | |
token: ${{ secrets.EDGEBIT_TOKEN }} | |
labels: "app=scip-typescript" | |
image-id: "${{ steps.build.outputs.imageid }}" | |
sbom-file: /tmp/sbom.spdx.json | |
component: scip-typescript | |
tags: "${{ github.ref == 'refs/heads/main' && 'latest' || '' }},${{ env.SHORT_SHA }}" |