-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (120 loc) · 4.53 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (120 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release
on:
push:
branches: [main]
tags: ["v*"]
permissions:
contents: read
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
discussions: write
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Docker metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
with:
images: deployah/deployah
# 'latest' only on stable tags (no pre-release suffix like -alpha, -beta, -rc)
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
type=edge,branch=${{ github.event.repository.default_branch }}
flavor: |
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
with:
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 10
- name: Login to Docker Hub
uses: docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set version
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7
with:
targets: artifact
provenance: false
set: |
artifact.cache-from=type=gha,scope=artifact
artifact.cache-to=type=gha,mode=max,scope=artifact
- name: Move artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
find ./dist -type f -not -name "SHA256SUMS" -exec mv {} ./dist/ \;
find ./dist -name "SHA256SUMS" -exec cat {} \; | sort -u > ./dist/SHA256SUMS.combined
mv ./dist/SHA256SUMS.combined ./dist/SHA256SUMS
find ./dist -type d -empty -delete
- name: Upload artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: deployah-artifacts
path: ./dist/*
if-no-files-found: error
- name: Install Cosign
if: startsWith(github.ref, 'refs/tags/')
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
- name: Sign release artifacts
if: startsWith(github.ref, 'refs/tags/')
env:
COSIGN_YES: "true"
run: |
set -euo pipefail
shopt -s nullglob
for f in dist/*.tar.gz dist/*.sha256sum dist/SHA256SUMS; do
cosign sign-blob --yes --bundle "${f}.sigstore.json" "$f"
done
- name: Build and push image
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7
with:
targets: image
push: true
sbom: true
provenance: true
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
set: |
image.cache-from=type=gha,scope=image
image.cache-to=type=gha,mode=max,scope=image
- name: Sync Docker Hub description
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5
if: github.ref_name == github.event.repository.default_branch
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: deployah/deployah
short-description: ${{ github.event.repository.description }}
- name: GitHub Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
discussion_category_name: Announcements
# TODO: add dist/*.zip once windows targets are enabled.
files: |
dist/*.tar.gz
dist/*.sha256sum
dist/SHA256SUMS
dist/*.sigstore.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}