Skip to content

Commit aec4cc9

Browse files
committed
workflows: add support for GitHub Actions
1 parent ede27ac commit aec4cc9

File tree

5 files changed

+195
-10
lines changed

5 files changed

+195
-10
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
VERSION:
5+
description: 'Version to build'
6+
required: false
7+
type: string
8+
TAG:
9+
description: 'Tag name to use'
10+
required: false
11+
type: string
12+
13+
env:
14+
VERSION: ${{ inputs.VERSION }}
15+
TAG: ${{ inputs.TAG }}
16+
17+
jobs:
18+
draft:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Run github-create-draft
24+
run: make github-create-draft
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
docker-build:
29+
needs: [draft]
30+
runs-on: ${{ matrix.runs_on }}
31+
strategy:
32+
matrix:
33+
include:
34+
- runs_on: [self-hosted, Linux, ARM64]
35+
docker_arch: arm64v8
36+
- runs_on: ubuntu-latest
37+
docker_arch: amd64
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
- name: Set up QEMU
42+
uses: docker/setup-qemu-action@v2
43+
- name: Login to Docker Hub
44+
uses: docker/login-action@v3
45+
with:
46+
username: ${{ secrets.DOCKERHUB_USERNAME }}
47+
password: ${{ secrets.DOCKERHUB_TOKEN }}
48+
- name: Run dockerhub for ${{matrix.docker_arch}}
49+
run: make ${{matrix.docker_arch}}-dockerhub
50+
- name: Run deb for ${{matrix.docker_arch}}
51+
run: make ${{matrix.docker_arch}}-deb
52+
- name: Upload deb files
53+
run: make github-upload-all
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
client-build:
58+
needs: [draft]
59+
runs-on: ${{ matrix.runs_on }}
60+
strategy:
61+
matrix:
62+
include:
63+
- runs_on: [self-hosted, Linux, ARM64]
64+
docker_arch: arm64v8
65+
- runs_on: ubuntu-latest
66+
docker_arch: amd64
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v3
70+
- name: Set up QEMU
71+
uses: docker/setup-qemu-action@v2
72+
- name: Run client for ${{matrix.docker_arch}}
73+
run: make ${{matrix.docker_arch}}-client
74+
- name: Upload artifacts
75+
run: make github-upload-all
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
79+
prerelease:
80+
runs-on: ubuntu-latest
81+
needs: [client-build, docker-build]
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v3
85+
- name: Login to Docker Hub
86+
uses: docker/login-action@v3
87+
with:
88+
username: ${{ secrets.DOCKERHUB_USERNAME }}
89+
password: ${{ secrets.DOCKERHUB_TOKEN }}
90+
- name: Run dockerhub-manifest
91+
run: make dockerhub-manifest
92+
- name: Run github-create-pre-release
93+
run: make github-create-pre-release
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build_test.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
push:
3+
branches:
4+
- '*'
5+
paths-ignore:
6+
- '*.md'
7+
- .github/workflows/*.yaml
8+
pull_request:
9+
workflow_dispatch:
10+
inputs:
11+
VERSION:
12+
description: 'Version to build'
13+
required: false
14+
type: string
15+
16+
env:
17+
VERSION: ${{ inputs.VERSION }}
18+
19+
jobs:
20+
docker-build:
21+
runs-on: ${{ matrix.runs_on }}
22+
strategy:
23+
matrix:
24+
include:
25+
- runs_on: [self-hosted, Linux, ARM64]
26+
docker_arch: arm64v8
27+
- runs_on: ubuntu-latest
28+
docker_arch: amd64
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v2
34+
- name: Run docker-build for ${{matrix.docker_arch}}
35+
run: make ${{matrix.docker_arch}}-docker-build
36+
37+
client-build:
38+
runs-on: ${{ matrix.runs_on }}
39+
strategy:
40+
matrix:
41+
include:
42+
- runs_on: [self-hosted, Linux, ARM64]
43+
docker_arch: arm64v8
44+
- runs_on: ubuntu-latest
45+
docker_arch: amd64
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v2
51+
- name: Run client for ${{matrix.docker_arch}}
52+
run: make ${{matrix.docker_arch}}-client

.github/workflows/pre_to_release.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
TAG:
5+
description: 'Tag name to use'
6+
required: false
7+
type: string
8+
9+
env:
10+
TAG: ${{ inputs.TAG }}
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.DOCKERHUB_USERNAME }}
22+
password: ${{ secrets.DOCKERHUB_TOKEN }}
23+
- name: Run dockerhub-latest-release
24+
run: make github-latest-release
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
BUILD_ARCHS = amd64 arm64v8
22
CLIENT_BUILD_ARCHS = amd64 arm64v8
33
REGISTRY ?= ayufan/proxmox-backup-server
4-
VERSION ?= $(shell ls versions | grep -E -v '.(tmp|debug)' | sort -V | tail -n 1)
4+
SHELL = /usr/bin/env bash
55

6-
TAG ?= $(VERSION)
6+
ifeq (,$(VERSION))
7+
VERSION := $(shell ls versions | grep -E -v '.(tmp|debug)' | sort -V | tail -n 1)
8+
endif
9+
10+
ifeq (,$(TAG))
11+
TAG := $(VERSION)
12+
endif
713

814
ifneq (,$(wildcard .env.mk))
915
include .env.mk
@@ -142,22 +148,28 @@ release: dockerhub client deb
142148

143149
export GITHUB_USER ?= ayufan
144150
export GITHUB_REPO ?= pve-backup-server-dockerfiles
151+
GITHUB_RELEASE_BIN ?= go run github.com/github-release/github-release@latest
152+
153+
github-create-draft:
154+
$(GITHUB_RELEASE_BIN) info -t $(TAG) || $(GITHUB_RELEASE_BIN) release -t $(TAG) --draft --description "$$(cat RELEASE.md)"
145155

146156
github-upload-all:
147-
@set -e; for file in release/$(TAG)/*.tgz release/$(TAG)/*/*.deb; do \
157+
@set -e; shopt -s nullglob; for file in release/$(TAG)/*.tgz release/$(TAG)/*/*.deb; do \
148158
echo "Uploading $$file..."; \
149-
github-release upload -t $(TAG) -R -n $$(basename $$file) -f $$file; \
159+
$(GITHUB_RELEASE_BIN) upload -t $(TAG) -R -n $$(basename $$file) -f $$file; \
150160
done
151161

162+
github-create-pre-release:
163+
$(GITHUB_RELEASE_BIN) edit -t $(TAG) --pre-release --description "$$(cat RELEASE.md)"
164+
152165
github-pre-release:
153166
rm -rf release/$(TAG)
154167
make release
155-
github-release --version || go install github.com/github-release/github-release@latest
156168
git push
157-
github-release info -t $(TAG) || github-release release -t $(TAG) --draft --description "$$(cat RELEASE.md)"
169+
make github-create-draft
158170
make github-upload-all
159-
github-release edit -t $(TAG) --pre-release --description "$$(cat RELEASE.md)"
171+
make github-create-pre-release
160172

161173
github-latest-release:
162-
github-release edit -t $(TAG) --description "$$(cat RELEASE.md)"
163174
make dockerhub-latest-release
175+
$(GITHUB_RELEASE_BIN) edit -t $(TAG) --description "$$(cat RELEASE.md)"

versions/v3.1.2/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN apt-get -y update && \
1414

1515
RUN wget https://static.rust-lang.org/rustup/rustup-init.sh && \
1616
chmod +x rustup-init.sh && \
17-
./rustup-init.sh -y --default-toolchain nightly
17+
./rustup-init.sh -y --default-toolchain stable
1818

19-
ENV RUSTUP_TOOLCHAIN=nightly
19+
ENV RUSTUP_TOOLCHAIN=stable
2020

2121
WORKDIR /src
2222

0 commit comments

Comments
 (0)