mirror of
https://github.com/nalgeon/redka.git
synced 2025-12-24 12:38:00 +08:00
85 lines
2.3 KiB
YAML
85 lines
2.3 KiB
YAML
name: publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
include:
|
|
- os: ubuntu-latest
|
|
goos: linux
|
|
asset_name: redka_linux_amd64.zip
|
|
- os: macos-latest
|
|
goos: darwin
|
|
asset_name: redka_darwin_amd64.zip
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "stable"
|
|
|
|
- name: Build binary
|
|
run: GOOS=${{ matrix.goos }} make build
|
|
|
|
- name: Zip the binary
|
|
run: zip -j ${{ matrix.asset_name }} build/redka
|
|
|
|
- name: Pack production binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.asset_name }}
|
|
path: ${{ matrix.asset_name }}
|
|
|
|
checksum:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts/
|
|
merge-multiple: true
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
cd artifacts
|
|
sha256sum * > checksums.txt
|
|
|
|
- name: Upload checksums file
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: checksums
|
|
path: artifacts/checksums.txt
|
|
|
|
release:
|
|
needs: checksum
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: release/
|
|
merge-multiple: true
|
|
|
|
- name: Upload assets to release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: release/*
|
|
file_glob: true
|
|
tag: ${{ github.ref }}
|