Skip to content

bump version

bump version #12

Workflow file for this run

name: Release
on:
push:
tags:
- v*.*.*
jobs:
publish-docker:
runs-on: [self-hosted, linux]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/DefGuard/yubikey-provision
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[registry."docker.io"]
mirrors = ["dockerhub-proxy.teonite.net"]
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
create-release:
name: create-release
runs-on: [self-hosted, linux]
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
build-release:
name: Release ${{ matrix.build }}
needs: ["create-release"]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux, linux-arm, linux-arm64]
include:
- build: linux
os: [self-hosted, linux]
asset_name: yubikey-provision-linux-x86_64
target: x86_64-unknown-linux-gnu
- build: linux-arm
os: [self-hosted, linux]
asset_name: yubikey-provision-linux-armv7
target: armv7-unknown-linux-gnueabihf
- build: linux-arm64
os: [self-hosted, linux]
asset_name: yubikey-provision-linux-arm64
target: aarch64-unknown-linux-gnu
steps:
# Store the version, stripping any v-prefix
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Rename binary
run: mv target/${{ matrix.target }}/release/yubikey-provision ${{ matrix.asset_name }}-${{ github.ref_name }}
- name: Tar
uses: a7ul/tar-action@v1.1.0
with:
command: c
files: |
${{ matrix.asset_name }}-${{ github.ref_name }}
outPath: ${{ matrix.asset_name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
- name: Upload release archive
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ matrix.asset_name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
asset_name: ${{ matrix.asset_name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
asset_content_type: application/octet-stream
- name: Build DEB package
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/yubikey-provision"
fpm_opts: "--debug -t deb --version=${{ env.VERSION }} -p yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.deb"
- name: Upload DEB
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.deb
asset_name: yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.deb
asset_content_type: application/octet-stream
- name: Build RPM package
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/yubikey-provision"
fpm_opts: "--debug -t rpm --version=${{ env.VERSION }} -p yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.rpm"
- name: Upload RPM
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.rpm
asset_name: yubikey-provision_${{ env.VERSION }}_${{ matrix.target }}.rpm
asset_content_type: application/octet-stream