NOJ - Debian package release hooks #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Matches v1.0.0, v2.1.3, etc. | |
- 'latest' | |
env: | |
DEB_PKG_NAME: gohip-${{ github.ref }}-x86_64.deb | |
RPM_PKG_NAME: gohip-${{ github.ref }}-1.x86_64.rpm | |
ARCH_PKG_NAME: gohip-bin-${{ github.ref }}-1-x86_64.pkg.tar.zst | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux] | |
goarch: [amd64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: | | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o gohip-${{ matrix.goos }}-${{ matrix.goarch }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_name: gohip-linux-amd64 | |
asset_path: ./gohip-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Create Debian package | |
env: | |
DESTDIR: '/tmp/gohip-deb' # keep path absolute - meson has issues with relative paths on CI | |
run: | | |
mkdir -p $DESTDIR | |
RELEASE_VERSION=$(echo ${{ github.ref }} | tr -d 'v') | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} RELEASE_VERSION=$RELEASE_VERSION DESTDIR=$DESTDIR make debian-pkg | |
find $DESTDIR | |
- name: Upload Debian release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
${{ env.DEB_PKG_NAME }} | |
${{ env.DEB_PKG_NAME }}.md5sum |