-
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (104 loc) · 3.48 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
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
# Some of this code is property of Hop Inc.
# via the MPL-2.0 license https://github.com/hopinc/cli
name: Release
on:
push:
tags:
- 'v*'
jobs:
draft-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Get tag data
id: tag
run: |
echo ::set-output name=tag_name::${GITHUB_REF#refs/*/}
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$ ]]; then
echo ::set-output name=pre_release::true
fi
- name: Create new release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ steps.tag.outputs.pre_release == 'true' }}
title: "Version: ${{ steps.tag.outputs.tag_name }}"
draft: true
publish-release:
name: Publish Release
needs: ["draft-release", "binary", "docker"]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create Checksums
run: for file in stockx-gif-*/stockx-gif-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Update Release
run: gh release edit ${{ needs.draft-release.outputs.tag_name }} --draft=false --repo=Fyko/stockx-gif
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Artifacts to Release
uses: softprops/action-gh-release@v1
with:
files: stockx-gif-*/stockx-gif-*
tag_name: ${{ needs.draft-release.outputs.tag_name }}
binary:
name: Build binary
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go 1.19
uses: actions/setup-go@v3
with:
go-version: '^1.19.1'
- name: Build
run: go build -v -o dist/stockx-gif
- name: Create tarball [*nix]
if: matrix.os != 'windows-latest'
run: |
cd dist
tar -cvzf stockx-gif-${{ matrix.os }}.tar.gz stockx-gif
- name: Create tarball [Windows]
if: matrix.os == 'windows-latest'
run: |
cd dist
7z a stockx-gif-${{ matrix.os }}.zip stockx-gif
- name: Upload tarball artifact
uses: actions/upload-artifact@v3
with:
name: stockx-gif-${{ matrix.os }}
path: dist/stockx-gif-${{ matrix.os }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
docker:
name: Docker
needs: ["draft-release"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
id: build
uses: redhat-actions/buildah-build@v2
with:
image: Fyko/stockx-gif
tags: latest ${{ needs.draft-release.outputs.tag_name }} ${{ github.sha }}
dockerfiles: |
./Dockerfile
build-args: |
CREATED_AT=${{ env.datetime }}
GITHUB_SHA=${{ github.sha }}
- name: Publish
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}