diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ad30b7b1..7b71476c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,69 +5,69 @@ on: types: [created] jobs: -# test: -# name: Run tests -# runs-on: ${{ matrix.os }} -# strategy: -# matrix: -# os: -# - macos-latest -# - ubuntu-latest -# - windows-latest -# steps: -# - name: Checkout code -# uses: actions/checkout@v2 -# - name: Set up Go 1.x -# uses: actions/setup-go@v2 -# with: -# go-version: ^1.14 -# - name: Run tests -# run: make ci -# -# build-all: -# name: Build all platforms -# runs-on: macos-latest -# needs: test -# steps: -# # strip off refs/tags/ and the v prefix (if it exists) -# - name: Set release env var -# run: | -# version=${GITHUB_REF#refs/*/} -# stripped_version=${version#v} -# echo ::set-env name=VERSION::${stripped_version} -# - name: Checkout code -# uses: actions/checkout@v2 -# - name: Set up Go 1.x -# uses: actions/setup-go@v2 -# with: -# go-version: ^1.14 -# - name: Vendor packages -# run: make mod -# - name: Install CI utilities -# run: make prepare -# - name: Compile binaries -# run: make compile -# - name: Package binaries -# run: make dist -# -# - name: Get release information -# id: get_release -# uses: bruceadams/get-release@v1.2.1 -# env: -# GITHUB_TOKEN: ${{ github.token }} -# -# - name: Upload Release Assets -# uses: NBTX/upload-release-assets@v1 -# env: -# GITHUB_TOKEN: ${{ github.token }} -# with: -# upload_url: ${{ steps.get_release.outputs.upload_url }} -# targets: ./dist/* + test: + name: Run tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + - name: Run tests + run: make ci + + build-all: + name: Build all platforms + runs-on: macos-latest + needs: test + steps: + # strip off refs/tags/ and the v prefix (if it exists) + - name: Set release env var + run: | + version=${GITHUB_REF#refs/*/} + stripped_version=${version#v} + echo ::set-env name=VERSION::${stripped_version} + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + - name: Vendor packages + run: make mod + - name: Install CI utilities + run: make prepare + - name: Compile binaries + run: make compile + - name: Package binaries + run: make dist + + - name: Get release information + id: get_release + uses: bruceadams/get-release@v1.2.1 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Upload Release Assets + uses: NBTX/upload-release-assets@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + targets: ./dist/* choco: name: Publish to Chocolatey runs-on: windows-latest -# needs: test + needs: test steps: - name: Set up Go 1.x @@ -84,6 +84,8 @@ jobs: - name: Build gossamer3 and push to choco run: .\choco\deploy.ps1 +# ---------------------------------------------------------------------------------------------------------------------- + # build-mac: # name: Mac build # runs-on: macos-latest diff --git a/choco/deploy.ps1 b/choco/deploy.ps1 index 045d9b429..411f25f45 100644 --- a/choco/deploy.ps1 +++ b/choco/deploy.ps1 @@ -2,10 +2,6 @@ Set-StrictMode -Version 'Latest' $version = $env:GITHUB_REF.Split("/")[2].Split('v')[1] -# Choco is already installed on Github runners -#echo "Install choco" -#Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - echo "Building gossamer3" go build -o "bin/gossamer3.exe" -ldflags "-X main.Version=${version}" "./cmd/gossamer3" @@ -26,6 +22,6 @@ echo "Zipping binary" $hash = Get-FileHash "gossamer3.zip" "$($hash.Hash) $(Split-Path $hash.Path -Leaf)" > "gossamer3.zip.sha256" -#echo "Push to choco" -#choco apiKey -k $env:CHOCO_API_KEY -source https://push.chocolatey.org/ -#choco push "./gossamer3.${version}.nupkg" +echo "Push to choco" +choco apiKey -k $env:CHOCO_API_KEY -source https://push.chocolatey.org/ +choco push "./gossamer3.${version}.nupkg"