Skip to content

Commit 376b9df

Browse files
committed
Update CI script to run goreleaser
1 parent d41c491 commit 376b9df

1 file changed

Lines changed: 24 additions & 80 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 24 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,34 @@
1-
name: Build Static Binaries
2-
on: [push]
1+
name: goreleaser
32

4-
jobs:
3+
on:
4+
push:
5+
tags:
6+
- '*'
57

6-
build-linux-amd64:
7-
name: Build Linux amd64
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-go@v1
12-
with:
13-
go-version: '1.18'
14-
- name: Dependencies
15-
run: |
16-
set -e
17-
sudo apt update
18-
sudo apt install -y libgtk-3-dev libglib2.0-dev libgdk-pixbuf2.0-dev
19-
- name: Build
20-
run: go build -o pdfrankenstein
21-
- uses: actions/upload-artifact@v1
22-
with:
23-
name: linux-amd64
24-
path: pdfrankenstein
8+
permissions:
9+
contents: write
10+
# packages: write
11+
# issues: write
2512

26-
release:
27-
name: Release
28-
needs: [build-linux-amd64]
13+
jobs:
14+
goreleaser:
2915
runs-on: ubuntu-latest
30-
if: startsWith(github.ref, 'refs/tags/v')
3116
steps:
32-
- uses: actions/download-artifact@v1
17+
- name: Checkout
18+
uses: actions/checkout@v2
3319
with:
34-
name: linux-amd64
35-
- name: Compress artifacts
36-
run: |
37-
( cd linux-amd64; chmod +x pdfrankenstein; zip ../pdfrankenstein-linux-amd64.zip pdfrankenstein )
38-
39-
- uses: actions/setup-python@v1
20+
fetch-depth: 0
21+
- name: Fetch all tags
22+
run: git fetch --force --tags
23+
- name: Set up Go
24+
uses: actions/setup-go@v2
4025
with:
41-
python-version: '3.x'
42-
- uses: docker://ferrarimarco/github-changelog-generator:latest
26+
go-version: 1.18
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v2
4329
with:
44-
args: -u oxplot -p pdfrankenstein
45-
- name: Generate Changelog
46-
id: gen_changelog
47-
env:
48-
RELEASE_REF: ${{ github.ref }}
49-
run: |
50-
cat CHANGELOG.md
51-
body="$(< CHANGELOG.md python -c '
52-
import sys
53-
import os
54-
55-
tag = os.getenv("RELEASE_REF").replace("refs/tags/", "")
56-
57-
in_block = False
58-
for l in sys.stdin:
59-
if l.startswith("## [%s]" % tag):
60-
in_block = True
61-
elif l.startswith("## ["):
62-
in_block = False
63-
if in_block:
64-
sys.stdout.write(l)
65-
')"
66-
# https://github.com/actions/create-release/issues/25#issuecomment-575435307
67-
body="${body//$'%'/%25}"
68-
body="${body//$'\n'/%0A}"
69-
body="${body//$'\r'/%0D}"
70-
echo ref $RELEASE_REF
71-
echo body $body
72-
echo "::set-output name=release_body::$body"
73-
74-
- id: create_release
75-
uses: actions/create-release@latest
30+
distribution: goreleaser
31+
version: latest
32+
args: release --rm-dist
7633
env:
7734
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
with:
79-
tag_name: ${{ github.ref }}
80-
release_name: ${{ github.ref }}
81-
body: ${{ steps.gen_changelog.outputs.release_body }}
82-
draft: true
83-
- uses: actions/upload-release-asset@v1
84-
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86-
with:
87-
upload_url: ${{ steps.create_release.outputs.upload_url }}
88-
asset_path: ./pdfrankenstein-linux-amd64.zip
89-
asset_name: pdfrankenstein-linux-amd64.zip
90-
asset_content_type: application/zip

0 commit comments

Comments
 (0)