-
Notifications
You must be signed in to change notification settings - Fork 5
64 lines (61 loc) · 2.07 KB
/
release.yml
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
---
name: 'Release'
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
permissions:
contents: write
jobs:
goreleaser:
name: 'Release the latest tag'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean -f ${{ vars.GORELEASER_CONFIG_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.TOFUENV_GITHUB_TOKEN }}
checksums:
name: 'Generate release checksums'
needs: goreleaser
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
run: |
curl -L --output tofuenv-$(echo $TAG | sed s/v//).tar.gz \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$TAG.tar.gz
curl -L --output tofuenv-$(echo $TAG | sed s/v//).zip \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$TAG.zip
env:
GITHUB_TOKEN: ${{ secrets.TOFUENV_GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
- name: Check contents
run: ls -la
- name: Generate checksum
run: |
shasum -a 256 *.tar.gz > checksums_$version.txt
shasum -a 256 *.zip >> checksums_$version.txt
env:
version: ${{ github.ref_name }}
- name: Upload checksum to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.TOFUENV_GITHUB_TOKEN }}
file: checksums_${{ github.ref_name }}.txt
tag: ${{ github.ref_name }}