@@ -3,9 +3,9 @@ name: Build, Test, and Push Docker Image
33on :
44 push :
55 branches :
6- - " dev-ci" # A push to this branch will trigger the image publication
6+ - " dev-ci"
77 pull_request :
8- branches : [ "master" ] # A pull request to master will build and test, but not publish
8+ branches : [ "master" ]
99 workflow_dispatch :
1010
1111env :
1515jobs :
1616 build-test-and-push :
1717 runs-on : ubuntu-latest
18- # Grant GITHUB_TOKEN permissions to write to the package registry
1918 permissions :
2019 contents : read
2120 packages : write
2423 - name : Checkout repository
2524 uses : actions/checkout@v4
2625 with :
27- lfs : true # Important for pulling the data.nc file
26+ lfs : true
2827
2928 - name : Log in to GitHub Container Registry
3029 uses : docker/login-action@v3
@@ -38,22 +37,21 @@ jobs:
3837 uses : docker/metadata-action@v5
3938 with :
4039 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41- # This action will generate useful tags based on the git event
42- # e.g., :dev-ci, :latest, :sha-abcdef1
4340
4441 - name : Build and push Docker image
4542 id : build-and-push
4643 uses : docker/build-push-action@v5
4744 with :
4845 context : .
49- # This condition ensures we only push on commits to the 'dev-ci' branch
5046 push : ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev-ci' }}
5147 tags : ${{ steps.meta.outputs.tags }}
5248 labels : ${{ steps.meta.outputs.labels }}
53- # 'load: true' makes the built image available to the Docker daemon for the next step
5449 load : true
5550
5651 - name : Run 'runff' Test Script on the built image
5752 run : |
58- echo "Testing image with digest: ${{ steps.build-and-push.outputs.digest }}"
59- docker run --rm ${{ steps.build-and-push.outputs.digest }} bash -c "cd tests/runff && bash ff-run.bash"
53+ # The 'tags' output is a multi-line string of all generated tags.
54+ # We'll grab the first tag from the list to use for our test.
55+ TEST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1)
56+ echo "Testing image with tag: $TEST_TAG"
57+ docker run --rm $TEST_TAG bash -c "cd tests/runff && bash ff-run.bash"
0 commit comments