-
Notifications
You must be signed in to change notification settings - Fork 82
102 lines (92 loc) · 3.59 KB
/
release-please.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
name: Build server for release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-server:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Download Go modules
run: go mod download
- name: Update beta version
if: ${{ ! steps.release.outputs.release_created }}
run: |
cp config_sample.yaml config.yaml
GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -ldflags '-w -s -buildid=' -o plugnmeet-server main.go
CURRENT_VERSION=$(./plugnmeet-server --version)
IFS='-' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
if [ ! "${VERSION_PARTS[1]}" ]; then
# increment main part
NEXT_VERSION=$(echo "${VERSION_PARTS[0]}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
NEXT_VERSION="${NEXT_VERSION}-0"
else
# it has seconds part, so we'll increment that only
NEW_BETA=$(echo "${VERSION_PARTS[1]}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
NEXT_VERSION="${VERSION_PARTS[0]}-${NEW_BETA}"
fi
echo "Changing version from: ${CURRENT_VERSION} To: ${NEXT_VERSION}"
sed -i "s/${CURRENT_VERSION}/${NEXT_VERSION}/" version/version.go
# now delete
rm -rf plugnmeet-server config.yaml
# push changes
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "bump beta version"
git push
- name: Upload server files
if: ${{ steps.release.outputs.release_created }}
run: make -j upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_RELEASE_UPLOAD_URL: ${{ steps.release.outputs.upload_url }}
- name: Docker meta
if: ${{ steps.release.outputs.release_created }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/plugnmeet-server
tags: |
type=ref,event=tag
type=semver,pattern=${{ steps.release.outputs.tag_name }},value=${{ steps.release.outputs.tag_name }}
type=semver,pattern=v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }},value=${{ steps.release.outputs.tag_name }}
- name: Set up QEMU
if: ${{ steps.release.outputs.release_created }}
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
if: ${{ steps.release.outputs.release_created }}
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Build and push
if: ${{ steps.release.outputs.release_created }}
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}