refine release workflow. #14
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
# .github/workflows/release.yaml | |
name: new release | |
on: | |
push: | |
tags: | |
- "*" # triggers only if push new tag version, like `0.8.4` or else | |
env: | |
PROJECT: aprilsh | |
BIN_DIR: bin | |
permissions: | |
contents: write | |
jobs: | |
release: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl } | |
# - { os: ubuntu-20.04, target: linux, platform: linux-x64, container: 'ubuntu:18.04' } | |
# - { os: ubuntu-20.04, target: linux, platform: linux-arm64, container: 'ubuntu:18.04' } | |
# - { os: macos-11, target: darwin, platform: darwin-x64 } | |
# - { os: macos-11, target: darwin, platform: darwin-arm64 } | |
# - { os: windows-latest, target: windows, platform: win32-ia32 } | |
# - { os: windows-latest, target: windows, platform: win32-x64 } | |
runs-on: ${{ matrix.os }} | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- name: prepare alpine container | |
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }} | |
run: | | |
apk update | |
apk add git bash | |
# apk add git nodejs | |
- name: checkout | |
uses: actions/checkout@master | |
# - name: Set up Go | |
# uses: actions/setup-go@master | |
# with: | |
# go-version: 1.21 | |
# - name: setting up workflow variables | |
# id: vars | |
# shell: bash | |
# run: | | |
# # Package version | |
# if [[ $GITHUB_REF = refs/tags/* ]]; then | |
# PKG_VERSION=${GITHUB_REF##*/} | |
# else | |
# PKG_VERSION=${GITHUB_SHA:0:7} | |
# fi | |
# | |
# # Package suffix relative to the platform | |
# if [[ "${{ matrix.target }}" = windows ]]; then | |
# PKG_SUFFIX="zip" | |
# else | |
# PKG_SUFFIX="tar.gz" | |
# fi | |
# | |
# # Package name w/ version | |
# PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}" | |
# if [[ "${{ matrix.libc }}" = musl ]]; then | |
# PKG_BASENAME="${PKG_BASENAME}-${{matrix.libc}}" | |
# fi | |
# | |
# # Full name of the tarball asset | |
# PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}" | |
# | |
# # Staging area for tarballs | |
# PKG_STAGING="ci_staging/$PKG_BASENAME" | |
# | |
# echo PKG_VERSION=${PKG_VERSION} >> $GITHUB_OUTPUT | |
# echo PKG_BASENAME=${PKG_BASENAME} >> $GITHUB_OUTPUT | |
# echo PKG_NAME=${PKG_NAME} >> $GITHUB_OUTPUT | |
# echo PKG_PATH="${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT | |
# echo PKG_STAGING=${PKG_STAGING} >> $GITHUB_OUTPUT | |
# | |
- name: collect build info | |
id: collect | |
shell: bash | |
run: | | |
git config --global --add safe.directory /__w/aprilsh/aprilsh | |
# touch build.info | |
echo "tag: `git describe --tags`" >> build.info | |
echo "commit: `git rev-parse HEAD`" >> build.info | |
echo "branch: `git rev-parse --abbrev-ref HEAD`" >> build.info | |
echo "*****" | |
head build.info | |
echo "*****" | |
# mkdir -p ${{ steps.vars.outputs.PKG_STAGING }} | |
# tar cvzf ${{ steps.vars.outputs.PKG_PATH }} \ | |
# build.info \ | |
# LICENSE \ | |
# README.md \ | |
# data \ | |
# doc \ | |
# encrypt \ | |
# frontend \ | |
# go.mod \ | |
# go.sum \ | |
# img \ | |
# network \ | |
# protobufs \ | |
# statesync \ | |
# terminal \ | |
# util | |
- name: publish release assets | |
uses: softprops/action-gh-release@master | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
generate_release_notes: true | |
files: | | |
${{ steps.vars.outputs.PKG_PATH }} |