-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (96 loc) · 3.23 KB
/
publish.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# mvp: https://github.com/mariadb-corporation/skysql-api-go/blob/main/.github/workflows/publish.yml
name: Publish
on:
push:
branches:
- master
- next
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
name: Publish new release
if: github.ref == 'refs/heads/master'
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Install specific git version
run: |
echo 🤮 for the next 3 lines
sudo apt-get update
sudo add-apt-repository ppa:git-core/ppa
sudo apt install git=1:2.34.1-1ubuntu1.10 git-man=1:2.34.1-1ubuntu1.10 -y --allow-downgrades
- name: Checkout
uses: actions/checkout@v4
with: # https://stackoverflow.com/a/65081720
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: "0"
- name: Install Auto
run : npm i -g auto @auto-it/upload-assets @auto-it/git-tag @auto-it/pr-body-labels @auto-it/exec
- name: Configure git
run: |
git config --global user.email "kbw-ci-bot@mail.ccil-kbw.com"
git config --global user.name "kbw-ci-bot"
- name: Publish new version
run: GH_TOKEN="${{ secrets.GITHUB_TOKEN }}" auto shipit
- id: version
name: Output new version
run: |
echo "$(git describe --tags)"
echo "version=$(git describe --tags)" >> "$GITHUB_OUTPUT"
releases-matrix:
needs: release
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64]
steps:
- name: Release Version
env:
RELEASE_VERSION: ${{ needs.release.outputs.version }}
run: echo "$RELEASE_VERSION"
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1.40
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://dl.google.com/go/go1.22.1.linux-amd64.tar.gz"
project_path: "./cmd/yt-upload-v2"
binary_name: "yt-upload-v2"
extra_files: README.md
release_tag: ${{ needs.release.outputs.version }}
docker-push:
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: AMD64 - Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}