Skip to content

Start using GITHUB_TOKEN instead #32

Start using GITHUB_TOKEN instead

Start using GITHUB_TOKEN instead #32

Workflow file for this run

name: Build and Release
on:
push:
tags:
- "v*"
jobs:
build:
strategy:
matrix:
# os: [linux, windows, darwin]
# arch: [amd64, arm64]
os: [darwin]
arch: [arm64]
runs-on: ubuntu-latest
environment: production
env:
SELF_UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SELF_UPDATE_PRIVATE_KEY: ${{ secrets.SELF_UPDATE_PRIVATE_KEY }}
SELF_UPDATE_PUBLIC_KEY: ${{ secrets.SELF_UPDATE_PUBLIC_KEY }}
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v3
with:
go-version: ^1.21
- name: Setup Repo
uses: actions/checkout@v3
- name: Install dependencies
run: go mod tidy
- name: Run Unit Tests
run: go test -v ./...
- name: Build cli
run: go build -o ./selfupdate ./cmd/selfupdate/main.go
- name: Create a Release
run: |
./selfupdate github release --owner blockthrough --repo selfupdate.go --version ${{ github.ref_name }} --title ${{ github.ref_name }}
- name: Build cli for all OS
run: |
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags "-X main.Version=${{ github.ref_name }}" -o ./selfupdate-${{ matrix.os }}-${{ matrix.arch }} ./cmd/selfupdate/main.go
- name: Release
run: |
./selfupdate github upload --owner blockthrough --repo selfupdate.go --filename selfupdate-${{ matrix.os }}-${{ matrix.arch }}.sign --version ${{ github.ref_name }} --sign < ./selfupdate-${{ matrix.os }}-${{ matrix.arch }}