1
+ name : 🏭 Draft Release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ bump :
7
+ description : ' Semver Bump Type'
8
+ required : true
9
+ default : ' patch'
10
+ type : choice
11
+ options :
12
+ - patch
13
+ - minor
14
+ - major
15
+
16
+ env :
17
+ REGISTRY : ghcr.io
18
+ IMAGE_NAME : ${{ github.repository }}
19
+
20
+ permissions :
21
+ contents : write
22
+ attestations : write
23
+ packages : write
24
+ id-token : write
25
+
26
+ jobs :
27
+ cut_release :
28
+ if : github.repository == 'PCSX2/web-api'
29
+ name : Cut Release
30
+ runs-on : ubuntu-latest
31
+ outputs :
32
+ new_tag : ${{ steps.set_tag.outputs.new_tag }}
33
+ steps :
34
+ # Docs - https://github.com/mathieudutour/github-tag-action
35
+ - name : Bump Version and Push Tag
36
+ id : tag_version
37
+ uses :
mathieudutour/[email protected]
38
+ with :
39
+ github_token : ${{ secrets.GITHUB_TOKEN }}
40
+ tag_prefix : v
41
+ default_bump : ${{ github.event.inputs.bump }}
42
+
43
+ - name : Create Release
44
+ env :
45
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46
+ run : gh release create ${{ steps.tag_version.outputs.new_tag }} --generate-notes --repo ${{ github.repository }}
47
+
48
+ - name : Output new tag
49
+ id : set_tag
50
+ run : |
51
+ echo "new_tag=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
52
+
53
+ publish_image :
54
+ if : github.repository == 'PCSX2/web-api'
55
+ name : " Build and Publish Image"
56
+ runs-on : ubuntu-latest
57
+ steps :
58
+ - uses : actions/checkout@v4
59
+ with :
60
+ ref : ${{ needs.cut_release.outputs.new_tag }}
61
+
62
+ - name : Log in to the Container registry
63
+ uses : docker/login-action@v3
64
+ with :
65
+ registry : ${{ env.REGISTRY }}
66
+ username : ${{ github.actor }}
67
+ password : ${{ secrets.GITHUB_TOKEN }}
68
+
69
+ - name : Extract metadata (tags, labels) for Docker
70
+ id : meta
71
+ uses : docker/metadata-action@v5
72
+ with :
73
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
74
+ tags : |
75
+ type=edge,branch=main
76
+ type=raw,value=${{ needs.cut_release.outputs.new_tag }}
77
+
78
+ - name : Build and push Docker image
79
+ id : push
80
+ uses : docker/build-push-action@v6
81
+ with :
82
+ context : .
83
+ push : true
84
+ tags : ${{ steps.meta.outputs.tags }}
85
+ labels : ${{ steps.meta.outputs.labels }}
86
+
87
+ - name : Generate artifact attestation
88
+ uses : actions/attest-build-provenance@v2
89
+ with :
90
+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
91
+ subject-digest : ${{ steps.push.outputs.digest }}
92
+ push-to-registry : true
0 commit comments