-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (158 loc) · 5.31 KB
/
release.yml
File metadata and controls
160 lines (158 loc) · 5.31 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Public docker release
on:
push:
tags:
- "*"
jobs:
# init:
# runs-on: ubuntu-latest
# outputs:
# release-version: ${{ steps.init.outputs.release-version }}
# matrix: ${{ steps.init.outputs.matrix }}
# targets: ${{ steps.init.outputs.targets }}
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - id: init
# run: |
# MATRIX=$(jq -Mc . .github/workflows/release_matrix.json)
# TARGETS=$(jq -Mc '.include | map(.target)' <<<${MATRIX})
#
# echo "release-version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
# echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT"
# echo "targets=${TARGETS}" >> "$GITHUB_OUTPUT"
# build-release:
# name: build-release
# runs-on: ${{ matrix.os }}
# needs: init
# env:
# STAGING: msg_decoder_bot_${{ needs.init.outputs.release-version }}-${{ matrix.target }}
# BINARY_PATH: target/${{ matrix.target }}/release/msg_decoder_bot
# strategy:
# matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Setup cross
# run: |
# cargo install cross
# - name: Build release binary
# run: cross build --verbose --release --target ${{ matrix.target }}
# - name: Strip release binary
# if: ${{ ! matrix.is_arm }}
# run: strip ${{ env.BINARY_PATH }}
# - name: ARMv7 - Strip release binary
# if: ${{ matrix.is_arm }}
# run: |
# sudo apt-get update
# sudo apt-get install -y binutils-arm-linux-gnueabihf
# arm-linux-gnueabihf-strip ${{ env.BINARY_PATH }}
# - name: Build tar.gz archive
# if: ${{ ! matrix.zip_archive }}
# shell: bash
# run: |
# mkdir ${{ env.STAGING }}
#
# mv ${{ env.BINARY_PATH }} ${{ env.STAGING }}/
# tar czf ${{ env.STAGING }}.tar.gz ${{ env.STAGING }}/
# - name: Build zip archive
# if: ${{ matrix.zip_archive }}
# shell: bash
# run: |
# mkdir ${{ env.STAGING }}
#
# mv ${{ env.BINARY_PATH }} ${{ env.STAGING }}/
# zip -r ${{ env.STAGING }}.zip ${{ env.STAGING }}/
# - name: Upload tar.gz archive
# if: ${{ ! matrix.zip_archive }}
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.STAGING }}
# path: ${{ env.STAGING }}.tar.gz
# - name: Upload zip archive
# if: ${{ matrix.zip_archive }}
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.STAGING }}
# path: ${{ env.STAGING }}.zip
publish-images:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.os }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and upload artifacts
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
outputs: type=image,name=msg-decoder-bot,annotation-index.org.opencontainers.image.description=Msg decoder bot multi-arch image
# create-release:
# name: create-release
# needs: [ init, build-release, push-images ]
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# - targets: ${{ fromJSON(needs.init.outputs.targets) }}
# env:
# PREFIX: msg_decoder_bot_${{ needs.init.outputs.release-version }}
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: ${{ env.PREFIX }}-${{ matrix.targets[0] }}
# - uses: actions/download-artifact@v4
# with:
# name: ${{ env.PREFIX }}-${{ matrix.targets[1] }}
# - uses: actions/download-artifact@v4
# with:
# name: ${{ env.PREFIX }}-${{ matrix.targets[2] }}
# - uses: actions/download-artifact@v4
# with:
# name: ${{ env.PREFIX }}-${{ matrix.targets[3] }}
# - uses: actions/download-artifact@v4
# with:
# name: ${{ env.PREFIX }}-${{ matrix.targets[4] }}
#
# - name: Create release
# uses: softprops/action-gh-release@v2
# with:
# files: |
# ${{ env.PREFIX }}-${{ matrix.targets[0] }}.tar.gz
# ${{ env.PREFIX }}-${{ matrix.targets[1] }}.tar.gz
# ${{ env.PREFIX }}-${{ matrix.targets[2] }}.zip
# ${{ env.PREFIX }}-${{ matrix.targets[3] }}.zip
# ${{ env.PREFIX }}-${{ matrix.targets[4] }}.zip