Skip to content

Update GitHub actions #69

Update GitHub actions

Update GitHub actions #69

Workflow file for this run

name: Release
on:
push:
tags:
- v*.*
jobs:
# Create packages, archives, ...
goreleaser:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Fetch history
run: git fetch --prune --unshallow
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Release via goreleaser
uses: goreleaser/goreleaser-action@master
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create MSI (Microsoft Installer) for ntt
msi:
needs: goreleaser
runs-on: windows-latest
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v4
- name: Install hub
run: |
Invoke-WebRequest https://github.com/github/hub/releases/download/v2.14.2/hub-windows-amd64-2.14.2.zip -OutFile hub.zip
Expand-Archive hub.zip -DestinationPath C:\hub
$env:PATH += ";C:\hub\bin"
- name: Download ntt.exe
id: download_exe
run: |
$env:PATH += ";C:\hub\bin"
$pattern = "refs/tags/(.+)"
if($env:GITHUB_REF -match $pattern) {
Write-Host "try to download zip archive for version ntt $($matches[1])"
hub.exe release download $($matches[1]) -i ntt_windows_x86_64.zip
Expand-Archive -v -Force -d . ntt_windows_x86_64.zip
} else {
Write-Error "error: provided reference does not contain a tag: $env:GITHUB_REF"
}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install go-msi
run: choco install -y "go-msi"
- name: Prepare PATH
shell: bash
run: |
echo "$WIX\\bin" >> $GITHUB_PATH
echo "C:\\Program Files\\go-msi" >> $GITHUB_PATH
- name: Build MSI
id: buildmsi
shell: bash
run: |
mkdir -p build
echo "executing: go-msi make --msi $PWD/ntt.msi --out $PWD/build --version ${GITHUB_REF#refs/tags/}"
go-msi make --msi "$PWD/ntt.msi" --out "$PWD/build" --version "${GITHUB_REF#refs/tags/}"
printf "msi=%s\n" *.msi >> "$GITHUB_OUTPUT"
- name: Upload MSI
run: |
$env:PATH += ";C:\hub\bin"
$pattern = "refs/tags/(.+)"
if($env:GITHUB_REF -match $pattern) {
Write-Host "try to upload msi file for version ntt $($matches[1])"
hub.exe release edit $($matches[1]) -m "" --draft=true -a "${{ steps.buildmsi.outputs.msi }}"
} else {
Write-Error "error: provided reference does not contain a tag: $env:GITHUB_REF"
}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}