Skip to content

Commit 4003d9d

Browse files
committed
Merge two release related workflows into one
1 parent 12f8b08 commit 4003d9d

File tree

2 files changed

+49
-53
lines changed

2 files changed

+49
-53
lines changed

.github/workflows/docker.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
name: Upload Docker images to ghcr.io
2-
on:
1+
---
2+
name: Create new release
3+
'on':
34
release:
45
types: [published]
56
workflow_dispatch:
@@ -12,6 +13,13 @@ jobs:
1213
docker:
1314
name: Build image
1415
runs-on: ubuntu-latest
16+
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
17+
permissions:
18+
packages: write
19+
contents: read
20+
attestations: write
21+
id-token: write
22+
1523
steps:
1624
- name: Check out code
1725
uses: actions/checkout@v4
@@ -45,3 +53,42 @@ jobs:
4553
context: .
4654
tags: ${{ steps.meta.outputs.tags }}
4755
labels: ${{ steps.meta.outputs.labels }}
56+
57+
build:
58+
name: Publish assets and packages
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: write
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
name: Checkout
66+
with:
67+
# Otherwise there's a risk to not get latest tag
68+
# We hope, that the current commit at
69+
# least 100 commits close to the latest release
70+
fetch-depth: 100
71+
fetch-tags: ${{ inputs.ref != '' }}
72+
ref: ${{ inputs.ref }}
73+
- name: Set up Go 1
74+
uses: actions/setup-go@v5
75+
with:
76+
go-version: ^1
77+
- name: Build packages
78+
id: build
79+
run: |
80+
go install github.com/goreleaser/nfpm/v2/cmd/[email protected]
81+
make -e CGO_ENABLED=0 packages
82+
- name: Upload release assets
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
TAG="${{ inputs.ref && inputs.ref || github.event.release.tag_name }}"
87+
gh release upload --clobber --repo ${{ github.repository }} "$TAG" \
88+
out/*.deb out/*.rpm out/*sum
89+
- name: Upload packages to packagecloud.com
90+
env:
91+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
92+
run: |
93+
go install github.com/mlafeldt/pkgcloud/cmd/pkgcloud-push@e79e9efc
94+
make packagecloud-stable

.github/workflows/upload-assets.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)