[integration-test] Only build on pushes to the main branch #5
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: Integration Test Image | |
on: | |
push: | |
branches: [trunk] | |
paths: | |
- 'integration-test/**' | |
- '.github/workflows/integration-test.yml' | |
pull_request: | |
paths: | |
- 'integration-test/**' | |
- '.github/workflows/integration-test.yml' | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: integration-test | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
run: | | |
TAG=$(echo $GITHUB_REF | cut -d / -f 3) | |
echo "GHCR_TAG=ghcr.io/${{github.repository}}/circt-integration-test:$TAG" >> $GITHUB_ENV | |
- name: Build image | |
run: docker build . --tag $GHCR_TAG | |
- name: Push image | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | |
docker push $GHCR_TAG |