Move version extraction to init #67
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: Release with goreleaser | |
on: | |
push: | |
tags: | |
- v*.* | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Unshallow Fetch | |
run: git fetch --prune --unshallow | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.16' | |
- name: Release via goreleaser | |
uses: goreleaser/goreleaser-action@master | |
with: | |
args: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
msi: | |
needs: goreleaser | |
runs-on: windows-latest | |
steps: | |
- name: Support longpaths | |
run: git config --system core.longpaths true | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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 "::set-output name=msi::%s\n" *.msi | |
- 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}} |