Skip to content

Commit fb9acc0

Browse files
committed
add upload-release-action
1 parent cee1b2c commit fb9acc0

File tree

1 file changed

+102
-77
lines changed

1 file changed

+102
-77
lines changed

.github/workflows/goreleaser.yml

Lines changed: 102 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,82 +19,107 @@ permissions:
1919

2020
jobs:
2121
release:
22+
name: Publish binaries
2223
runs-on: ubuntu-latest
2324
steps:
24-
- uses: actions/checkout@v4
25-
if: github.event_name == 'pull_request'
26-
with:
27-
fetch-depth: 0
28-
ref: ${{ github.event.pull_request.head.ref }}
29-
- uses: actions/checkout@v4
30-
if: github.event_name != 'pull_request'
31-
with:
32-
fetch-depth: 0
33-
- name: setup-go
34-
uses: actions/setup-go@v5
35-
with:
36-
go-version: 1.21.x
37-
- name: setup qemu
38-
id: qemu
39-
uses: docker/setup-qemu-action@v3
40-
- name: setup docker buildx
41-
id: buildx
42-
uses: docker/setup-buildx-action@v3
43-
- name: Login to GitHub Container Registry
44-
uses: docker/login-action@v3
45-
with:
46-
registry: ghcr.io
47-
username: ${{ github.actor }}
48-
password: ${{ secrets.GITHUB_TOKEN }}
49-
- name: install cosign
50-
uses: sigstore/cosign-installer@v3
51-
- name: install quill
52-
env:
53-
QUILL_VERSION: 0.4.1
54-
run: |
55-
curl -Lo /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz https://github.com/anchore/quill/releases/download/v${QUILL_VERSION}/quill_${QUILL_VERSION}_linux_amd64.tar.gz
56-
tar -xvf /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz -C /tmp
57-
mv /tmp/quill /usr/local/bin/quill
58-
chmod +x /usr/local/bin/quill
59-
- name: set goreleaser default args
60-
if: startsWith(github.ref, 'refs/tags/') == true
61-
run: |
62-
echo "GORELEASER_ARGS=" >> $GITHUB_ENV
63-
- name: set goreleaser args for branch
64-
if: startsWith(github.ref, 'refs/tags/') == false
65-
run: |
66-
echo "GORELEASER_ARGS=--snapshot" >> $GITHUB_ENV
67-
- name: set goreleaser args renovate
68-
if: startsWith(github.ref, 'refs/heads/renovate') == true
69-
run: |
70-
echo "GORELEASER_ARGS=--snapshot --skip-publish" >> $GITHUB_ENV
71-
# - name: setup quill
72-
# uses: 1password/load-secrets-action@v2
73-
# if: startsWith(github.ref, 'refs/tags/') == true && github.actor == github.repository_owner
74-
# with:
75-
# export-env: true
76-
# env:
77-
# OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
78-
# QUILL_NOTARY_KEY: ${{ secrets.OP_QUILL_NOTARY_KEY }}
79-
# QUILL_NOTARY_KEY_ID: ${{ secrets.OP_QUILL_NOTARY_KEY_ID }}
80-
# QUILL_NOTARY_ISSUER: ${{ secrets.OP_QUILL_NOTARY_ISSUER }}
81-
# QUILL_SIGN_PASSWORD: ${{ secrets.OP_QUILL_SIGN_PASSWORD }}
82-
# QUILL_SIGN_P12: ${{ secrets.OP_QUILL_SIGN_P12 }}
83-
- name: run goreleaser
84-
uses: goreleaser/goreleaser-action@v6
85-
with:
86-
distribution: goreleaser
87-
version: latest
88-
args: release --clean ${{ env.GORELEASER_ARGS }}
89-
env:
90-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91-
- name: push docker images (for branches)
92-
if: github.ref == 'refs/heads/main' || github.event.pull_request.base.ref == 'main'
93-
run: |
94-
docker images --format "{{.Repository}}:{{.Tag}}" | grep "${{ github.repository }}" | xargs -L1 docker push
95-
- name: upload artifacts
96-
if: ${{ github.event.pull_request.base.ref == 'main' || github.event_name == 'workflow_dispatch' }}
97-
uses: actions/upload-artifact@v4
98-
with:
99-
name: binaries
100-
path: releases/*.tar.gz
25+
- name: Setup Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version: 1.21.x
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Build Project binaries
34+
env:
35+
CGO_ENABLED: 0
36+
run: |
37+
make xc
38+
- name: Upload binaries to release
39+
uses: svenstaro/upload-release-action@v2
40+
with:
41+
repo_token: ${{ secrets.GITHUB_TOKEN }}
42+
file: dist/aws*
43+
tag: ${{ github.ref }}
44+
overwrite: true
45+
file_glob: true
46+
# release:
47+
# runs-on: ubuntu-latest
48+
# steps:
49+
# - uses: actions/checkout@v4
50+
# if: github.event_name == 'pull_request'
51+
# with:
52+
# fetch-depth: 0
53+
# ref: ${{ github.event.pull_request.head.ref }}
54+
# - uses: actions/checkout@v4
55+
# if: github.event_name != 'pull_request'
56+
# with:
57+
# fetch-depth: 0
58+
# - name: setup-go
59+
# uses: actions/setup-go@v5
60+
# with:
61+
# go-version: 1.21.x
62+
# - name: setup qemu
63+
# id: qemu
64+
# uses: docker/setup-qemu-action@v3
65+
# - name: setup docker buildx
66+
# id: buildx
67+
# uses: docker/setup-buildx-action@v3
68+
# - name: Login to GitHub Container Registry
69+
# uses: docker/login-action@v3
70+
# with:
71+
# registry: ghcr.io
72+
# username: ${{ github.actor }}
73+
# password: ${{ secrets.GITHUB_TOKEN }}
74+
# - name: install cosign
75+
# uses: sigstore/cosign-installer@v3
76+
# - name: install quill
77+
# env:
78+
# QUILL_VERSION: 0.4.1
79+
# run: |
80+
# curl -Lo /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz https://github.com/anchore/quill/releases/download/v${QUILL_VERSION}/quill_${QUILL_VERSION}_linux_amd64.tar.gz
81+
# tar -xvf /tmp/quill_${QUILL_VERSION}_linux_amd64.tar.gz -C /tmp
82+
# mv /tmp/quill /usr/local/bin/quill
83+
# chmod +x /usr/local/bin/quill
84+
# - name: set goreleaser default args
85+
# if: startsWith(github.ref, 'refs/tags/') == true
86+
# run: |
87+
# echo "GORELEASER_ARGS=" >> $GITHUB_ENV
88+
# - name: set goreleaser args for branch
89+
# if: startsWith(github.ref, 'refs/tags/') == false
90+
# run: |
91+
# echo "GORELEASER_ARGS=--snapshot" >> $GITHUB_ENV
92+
# - name: set goreleaser args renovate
93+
# if: startsWith(github.ref, 'refs/heads/renovate') == true
94+
# run: |
95+
# echo "GORELEASER_ARGS=--snapshot --skip-publish" >> $GITHUB_ENV
96+
# - name: setup quill
97+
# uses: 1password/load-secrets-action@v2
98+
# if: startsWith(github.ref, 'refs/tags/') == true && github.actor == github.repository_owner
99+
# with:
100+
# export-env: true
101+
# env:
102+
# OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
103+
# QUILL_NOTARY_KEY: ${{ secrets.OP_QUILL_NOTARY_KEY }}
104+
# QUILL_NOTARY_KEY_ID: ${{ secrets.OP_QUILL_NOTARY_KEY_ID }}
105+
# QUILL_NOTARY_ISSUER: ${{ secrets.OP_QUILL_NOTARY_ISSUER }}
106+
# QUILL_SIGN_PASSWORD: ${{ secrets.OP_QUILL_SIGN_PASSWORD }}
107+
# QUILL_SIGN_P12: ${{ secrets.OP_QUILL_SIGN_P12 }}
108+
# - name: run goreleaser
109+
# uses: goreleaser/goreleaser-action@v6
110+
# with:
111+
# distribution: goreleaser
112+
# version: latest
113+
# args: release --clean ${{ env.GORELEASER_ARGS }}
114+
# env:
115+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
# - name: push docker images (for branches)
117+
# if: github.ref == 'refs/heads/main' || github.event.pull_request.base.ref == 'main'
118+
# run: |
119+
# docker images --format "{{.Repository}}:{{.Tag}}" | grep "${{ github.repository }}" | xargs -L1 docker push
120+
# - name: upload artifacts
121+
# if: ${{ github.event.pull_request.base.ref == 'main' || github.event_name == 'workflow_dispatch' }}
122+
# uses: actions/upload-artifact@v4
123+
# with:
124+
# name: binaries
125+
# path: releases/*.tar.gz

0 commit comments

Comments
 (0)