Skip to content

feat(action-cd): prepare and publish release #9

feat(action-cd): prepare and publish release

feat(action-cd): prepare and publish release #9

Workflow file for this run

name: Continuous Delivery
on:
push:
tags:
- 'v*'
env:
BUILD_RELEASE_OUTPUT: sr65-app
GO_VERSION: '1.20'
jobs:
prepare_release:
name: Prepare Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
generate_release_notes: true
draft: true
build_release:
name: Build Release
needs: prepare_release
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
include:
- os: ubuntu-latest
release_tag_os: linux
ffmpeg_version: '6.0.1'
- os: macos-latest
release_tag_os: darwin
ffmpeg_version: '6.1.1'
- os: windows-latest
release_tag_os: windows
ffmpeg_version: '6.1.1'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up FFMPEG
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
with:
ffmpeg-version: ${{ matrix.ffmpeg_version }}
architecture: ${{ matrix.arch == 'amd64' && 'x64' || matrix.arch }}
github-token: ${{ github.server_url == 'https://github.com' && github.token || '' }}
if: ${{ !(matrix.os == 'windows-latest' && matrix.arch == 'arm64') && !(matrix.os == 'macos-latest' && matrix.arch == 'arm64') }}
- name: Embedding FFMPEG binary
run: cp ${{ steps.setup-ffmpeg.outputs.ffmpeg-path }}/ffmpeg* embed/bin
if: ${{ !(matrix.os == 'windows-latest' && matrix.arch == 'arm64') && !(matrix.os == 'macos-latest' && matrix.arch == 'arm64') }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
shell: bash
run: GOARCH=${{ matrix.arch }} go build
- name: Archive
id: archive
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
OUTPUT=${{ env.BUILD_RELEASE_OUTPUT }}_${{ matrix.release_tag_os }}_${{ matrix.arch }}.zip
7z a $OUTPUT ${{ env.BUILD_RELEASE_OUTPUT }}.exe
else
OUTPUT=${{ env.BUILD_RELEASE_OUTPUT }}_${{ matrix.release_tag_os }}_${{ matrix.arch }}.tar.gz
tar -czvf $OUTPUT ${{ env.BUILD_RELEASE_OUTPUT }}
fi
echo "output=$OUTPUT" >> "$GITHUB_OUTPUT"
- name: Upload Release Asset
run: gh release upload ${{ github.ref_name }} ${{ steps.archive.outputs.output }}
env:
GH_TOKEN: ${{ secrets.github_token }}
publish_release:
name: Publish Release
needs: [prepare_release,build_release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish Release
run: gh release edit ${{ github.ref_name }} --draft=false
env:
GH_TOKEN: ${{ secrets.github_token }}