-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (114 loc) · 3.98 KB
/
release.yml
File metadata and controls
114 lines (114 loc) · 3.98 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
name: Release
on:
workflow_run:
workflows: ["Build and test"]
branches: [main]
types:
- completed
permissions:
contents: write
packages: write
pages: write
security-events: write
actions: read
jobs:
bump-version:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: arnested/go-version-action@v1
id: go-version
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.75.0
id: version
env:
GITHUB_TOKEN: ${{ github.token }}
WITH_V: true
DEFAULT_BUMP: patch
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
- name: Set up Go ${{ steps.go-version.outputs.latest }}
uses: WillAbides/setup-go-faster@v1.14.0
with:
go-version: ${{ steps.go-version.outputs.latest }}.x
ignore-local: true
- run: go version
- name: Install changelog management tool
run: go install github.com/goreleaser/chglog/cmd/chglog@main
- name: Build changelog
run: chglog init
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Import GPG signing key
run: |
mkdir -p -m 0700 ~/.gnupg/
printf -- "${{ secrets.GPG_SIGNING_KEY }}" > ~/.gnupg/private-key.asc
gpg --import --no-tty --batch --yes ~/.gnupg/private-key.asc
- name: Copy deb packages into build area
run: |
mkdir -p site
cp -v dist/*.deb site/
- name: Scan packages
run: |
apt-ftparchive packages . > Packages
gzip -k -f Packages
working-directory: site
- name: apt-ftparchive release
run: |
apt-ftparchive -o APT::FTPArchive::Release::Origin="Arne Jørgensen" -o APT::FTPArchive::Release::Label="${{ steps.go-version.outputs.module }}" release . > Release
echo "Changelogs: $(gh api /repos/{owner}/{repo}/pages --jq .html_url)changelog?path=@CHANGEPATH@" >> Release
gpg -abs --no-tty --batch --yes -o - Release > Release.gpg
gpg --clearsign --no-tty --batch --yes -o - Release > InRelease
working-directory: site
env:
GH_TOKEN: ${{ github.token }}
- uses: ZacJW/markdown-html-action@1.2.0
with:
input_files: '[["README.md"]]'
output_files: '["README.html"]'
- name: Fix link / package name in GitHub Pages
run: |
DEB=$(grep linux_amd64.deb dist/checksums.txt | awk '{print $2}')
sed -i "s/system-state_.*_linux_amd64.deb/<a href=\"https:\/\/github.com\/arnested\/system-state\/releases\/latest\/download\/${DEB}\">${DEB}<\/a>/" README.html
sed -i 's/<!DOCTYPE html>//' README.html
cat page/header.html README.html page/footer.html > site/index.html
- name: Add changelog to GitHub Pages
run: chglog format --template deb --output site/changelog
- name: Deploy deb packages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: site
clean: true
single-commit: true
- name: Post status to Google Chat
if: ${{ always() }}
uses: containrrr/shoutrrr-action@v1
with:
url: "${{ secrets.WATCHTOWER_NOTIFICATION_URL }}"
message: "Released `${{ github.repository }}`@`${{ github.sha }}` as ${{ steps.version.outputs.tag }}: *${{ job.status }}*."
docker-build:
name: Docker build and push
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ github.repository }}:latest
push: true