forked from awslabs/soci-snapshotter
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (82 loc) · 2.81 KB
/
releases.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
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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: ['main', 'release/**']
paths:
- '.github/workflows/releases.yml'
- 'scripts/**'
- 'Makefile'
env:
GO_VERSION: '1.21.10'
permissions:
contents: write
deployments: write
jobs:
generate-artifacts:
runs-on: ubuntu-22.04
env:
# Set during setup.
RELEASE_TAG: ''
DYNAMIC_BINARY_NAME: ''
STATIC_BINARY_NAME: ''
steps:
- uses: actions/checkout@v4
- name: Export cleaned release tag
run: |
export release_tag=${GITHUB_REF#refs/*/} # Strip down to raw tag name
echo "RELEASE_TAG=${release_tag}" >> $GITHUB_ENV
- name: Create dummy environment for release
if: github.event_name == 'pull_request'
run: |
touch THIRD_PARTY_LICENSES
echo "RELEASE_TAG=v0.0.0" >> $GITHUB_ENV
- name: Setup variables and release directories
run: |
export release_tag=${{ env.RELEASE_TAG }}
export release_version=${release_tag/v/} # Remove v from tag name
echo "DYNAMIC_BINARY_NAME=soci-snapshotter-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV
echo "STATIC_BINARY_NAME=soci-snapshotter-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV
mkdir release
- name: Create release binaries
run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: release/
if-no-files-found: error
outputs:
release_tag: ${{ env.RELEASE_TAG }}
dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }}
static_binary_name: ${{ env.STATIC_BINARY_NAME }}
validate-artifacts:
needs: generate-artifacts
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: artifacts
path: release/
- run: bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }}
create-release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [generate-artifacts, validate-artifacts]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: artifacts
- uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
generate_release_notes: false
files: |
${{ needs.generate-artifacts.outputs.dynamic_binary_name }}
${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum
${{ needs.generate-artifacts.outputs.static_binary_name }}
${{ needs.generate-artifacts.outputs.static_binary_name }}.sha256sum