Skip to content

Commit

Permalink
workflow: as latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Feb 5, 2024
1 parent 856da99 commit 115d41d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 16 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/build_release.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
on:
push:
tags:
- '*'
workflow_dispatch:
VERSION:
description: 'Version to build'
required: false
type: string
TAG:
description: 'Tag name to use'
required: false
type: string

env:
VERSION: ${{ inputs.VERSION }}
TAG: ${{ inputs.TAG }}

jobs:
draft:
Expand All @@ -14,11 +23,15 @@ jobs:
run: make github-create-draft

docker-build:
runs-on: ubuntu-latest
needs: [draft]
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
docker_arch: [amd64, arm64v8]
include:
- runs_on: [self-hosted, Linux, ARM64]
docker_arch: arm64v8
- runs_on: ubuntu-latest
docker_arch: amd64
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -32,11 +45,15 @@ jobs:
run: make github-upload-all

client-build:
runs-on: ubuntu-latest
needs: [draft]
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
docker_arch: [amd64, arm64v8]
include:
- runs_on: [self-hosted, Linux, ARM64]
docker_arch: arm64v8
- runs_on: ubuntu-latest
docker_arch: amd64
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ on:
- '*'
paths-ignore:
- '*.md'
- .github/workflows/*.yaml
pull_request:
workflow_dispatch:
VERSION:
description: 'Version to build'
required: false
type: string

env:
VERSION: ${{ inputs.VERSION }}

jobs:
docker-build:
runs-on: ${{ matrix.runs_on }}
strategy: &build_variants
strategy:
matrix:
include:
- runs_on: [self-hosted, Linux, ARM64]
Expand All @@ -27,7 +35,13 @@ jobs:

client-build:
runs-on: ${{ matrix.runs_on }}
strategy: *build_variants
strategy:
matrix:
include:
- runs_on: [self-hosted, Linux, ARM64]
docker_arch: arm64v8
- runs_on: ubuntu-latest
docker_arch: amd64
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/pre_to_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
workflow_dispatch:
TAG:
description: 'Tag name to use'
required: false
type: string

env:
TAG: ${{ inputs.TAG }}

jobs:
release:
runs-on: ubuntu-latest
needs: [client-build, docker-build]
if: inputs.TAG
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run dockerhub-latest-release
run: make github-latest-release
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
BUILD_ARCHS = amd64 arm64v8
CLIENT_BUILD_ARCHS = amd64 arm64v8
REGISTRY ?= ayufan/proxmox-backup-server
VERSION ?= $(shell ls versions | grep -E -v '.(tmp|debug)' | sort -V | tail -n 1)

TAG ?= $(VERSION)
ifeq (,$(VERSION))
VERSION := $(shell ls versions | grep -E -v '.(tmp|debug)' | sort -V | tail -n 1)
endif

ifeq (,$(TAG))
TAG := $(VERSION)
endif

ifneq (,$(wildcard .env.mk))
include .env.mk
Expand Down Expand Up @@ -143,18 +148,20 @@ release: dockerhub client deb
export GITHUB_USER ?= ayufan
export GITHUB_REPO ?= pve-backup-server-dockerfiles

github-create-draft:
github-release:
github-release --version || go install github.com/github-release/github-release@latest

github-create-draft: github-release
git push
github-release info -t $(TAG) || github-release release -t $(TAG) --draft --description "$$(cat RELEASE.md)"

github-upload-all:
github-upload-all: github-release
@set -e; for file in release/$(TAG)/*.tgz release/$(TAG)/*/*.deb; do \
echo "Uploading $$file..."; \
github-release upload -t $(TAG) -R -n $$(basename $$file) -f $$file; \
done

github-create-pre-release:
github-create-pre-release: github-release
github-release edit -t $(TAG) --pre-release --description "$$(cat RELEASE.md)"

github-pre-release:
Expand All @@ -164,6 +171,6 @@ github-pre-release:
make github-upload-all
make github-create-pre-release

github-latest-release:
github-release edit -t $(TAG) --description "$$(cat RELEASE.md)"
github-latest-release: github-release
make dockerhub-latest-release
github-release edit -t $(TAG) --description "$$(cat RELEASE.md)"

0 comments on commit 115d41d

Please sign in to comment.