-
Notifications
You must be signed in to change notification settings - Fork 14
58 lines (48 loc) · 1.71 KB
/
releaser.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
name: goreleaser
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-20.04
environment: releaser
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20.4'
cache: true
- name: Validate Plex version and tag
run: |
current_version=$(grep -oP 'CurrentPlexVersion\s*=\s*"\K[^"]+' cmd/upgrade.go)
tag_name=${GITHUB_REF#refs/tags/}
if [ "$current_version" != "$tag_name" ]; then
echo "CurrentPlexVersion in cmd/upgrade.go ($current_version) does not match tag ($tag_name)"
exit 1
else
echo "CurrentPlexVersion in cmd/upgrade.go ($current_version) matches tag ($tag_name)"
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get tag name and release name
id: tag_name
run: |
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
echo "::set-output name=release::${GITHUB_REF#refs/tags/v}"
- name: Download release file
run: curl -sSL https://github.com/labdao/plex/releases/download/${{ steps.tag_name.outputs.tag }}/plex_${{ steps.tag_name.outputs.release }}_linux_amd64.tar.gz -o plex_${{ steps.tag_name.outputs.release }}_linux_amd64.tar.gz
- name: Extract release file
run: tar -xvzf plex_${{ steps.tag_name.outputs.release }}_linux_amd64.tar.gz