Skip to content

Commit 253ff1f

Browse files
authored
Merge pull request #29 from go-graphite/fix-releaser
Fix releaser
2 parents 688d71f + 81e2c6b commit 253ff1f

File tree

4 files changed

+96
-104
lines changed

4 files changed

+96
-104
lines changed

.github/workflows/docker.yml

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

.github/workflows/release.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
name: Create new release
3+
'on':
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: 'Git tag to push the image'
10+
required: true
11+
type: string
12+
jobs:
13+
docker:
14+
name: Build image
15+
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+
23+
steps:
24+
- name: Check out code
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ inputs.ref }}
28+
- name: Docker meta
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
context: ${{ inputs.ref && 'git' || 'workflow' }}
33+
images: ghcr.io/${{ github.repository }}
34+
# create latest tag for branch events
35+
flavor: |
36+
latest=${{ inputs.ref && 'false' || 'auto' }}
37+
tags: |
38+
type=semver,pattern={{version}},value=${{inputs.ref}}
39+
type=semver,pattern={{major}}.{{minor}},value=${{inputs.ref}}
40+
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{inputs.ref}}
41+
- name: Login to ghcr.io
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Build and push
48+
id: docker_build
49+
uses: docker/build-push-action@v5
50+
with:
51+
# push for non-pr events
52+
push: ${{ github.event_name != 'pull_request' }}
53+
context: .
54+
tags: ${{ steps.meta.outputs.tags }}
55+
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.

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,11 @@ $(SUM_FILES): nfpm
114114

115115
.ONESHELL:
116116
packagecloud-push-rpm: $(wildcard out/$(NAME)-$(VERSION)*.rpm)
117-
for repo in el/{7..9}; do
118-
pkgcloud-push $(REPO)/$${repo} $^ || true
119-
done
117+
pkgcloud-push $(REPO)/rpm_any/rpm_any $^ || true
120118

121119
.ONESHELL:
122120
packagecloud-push-deb: $(wildcard out/$(NAME)_$(VERSION)*.deb)
123-
for repo in ubuntu/{bionic,focal,jammy,nomble} debian/{buster,bullseye,bookworm}; do
124-
pkgcloud-push $(REPO)/$${repo} $^ || true
125-
done
121+
pkgcloud-push $(REPO)/any/any $^ || true
126122

127123
packagecloud-push: nfpm
128124
@$(MAKE) packagecloud-push-rpm

0 commit comments

Comments
 (0)