1+ name : Publish Docker images
2+ on :
3+ release :
4+ types : [ published ]
5+ push :
6+ branches :
7+ - master
8+ - develop
9+
10+ jobs :
11+ PushDockerImages :
12+ if : github.repository == 'CollaborativeStateMachines/Cirrina-Baselines'
13+ name : Push ${{ matrix.target }} Image
14+ runs-on : ubuntu-latest
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ target : [ diningPhilosophers ]
19+ permissions :
20+ packages : write
21+ contents : read
22+ attestations : write
23+ id-token : write
24+ steps :
25+ - name : Check out the repo
26+ uses : actions/checkout@v4
27+
28+ - name : Log in to Docker Hub
29+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
30+ with :
31+ username : ${{ secrets.DOCKER_USERNAME }}
32+ password : ${{ secrets.DOCKER_PASSWORD }}
33+
34+ - name : Extract metadata (tags, labels) for Docker
35+ id : meta
36+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
37+ with :
38+ images : collaborativestatemachines/cirrina-baselines-${{ matrix.target }}
39+ tags : |
40+ type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
41+ type=raw,value=stable,enable=${{ github.event_name == 'release' }}
42+
43+ type=raw,value=nightly,enable=${{ github.ref == 'refs/heads/master' }}
44+ type=sha,enable=${{ github.ref == 'refs/heads/master' }}
45+
46+ type=raw,value=unstable,enable=${{ github.ref == 'refs/heads/develop' }}
47+ type=sha,enable=${{ github.ref == 'refs/heads/develop' }}
48+
49+ - name : Build and push Docker image
50+ id : push
51+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
52+ with :
53+ context : .
54+ file : ./${{ matrix.target }}.Dockerfile
55+ push : true
56+ tags : ${{ steps.meta.outputs.tags }}
57+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments