Skip to content

chore: arrange release-build ci #37

chore: arrange release-build ci

chore: arrange release-build ci #37

Workflow file for this run

name: "Release Build"
on:
push:
tags: # Push events to matching v*, i.e. v20.15.10, v0.1.2-rc34
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
jobs:
create_tarball:
name: "Create Tarball"
runs-on: ubuntu-latest
steps:
- name: "Set tag as version"
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0
- name: "Checkout code"
uses: actions/checkout@v3.1.0
- name: "Create compressed repository source"
run: |
git archive --format=tar.gz --prefix="fnsad-${{ env.VERSION }}/" HEAD -o fnsad-${{ env.VERSION }}.tar.gz
- name: "Store compressed source"
uses: actions/upload-artifact@v3
with:
name: release-${{ env.VERSION }}
path: |
fnsad-${{ env.VERSION }}.tar.gz
build_for_linux_static:
name: "Release Build for linux(static)"
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
steps:
- name: Set tag as version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set ID=${{ env.VERSION }}-linux-${{ matrix.arch }}
run: echo "ID=${{ env.VERSION }}-linux-${{ matrix.arch }}" >> $GITHUB_ENV
- name: Compile finschia
run: |
make build-reproducible-${{ matrix.arch }}
cd ./build
mv fnsad-linux-${{ matrix.arch }} fnsad-${{ env.ID }}
- name: Store artifact linux-${{ matrix.arch }}
uses: actions/upload-artifact@v3
with:
name: release-${{ env.VERSION }}
path: |
./build/fnsad-${{ env.ID }}
create_release:
name: Create Release
needs: [ build_for_linux_static, create_tarball ]
runs-on: ubuntu-latest
steps:
- name: Set tag as version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: release-${{ env.VERSION }}
- name: Extract compressed repository source
run: |
tar zxvf fnsad-${{ env.VERSION }}.tar.gz --strip-components=1 fnsad-${{ env.VERSION }}/RELEASE_NOTE.md
- name: Create build report
run: |
echo "App: finschia" >> build_report.txt
echo "Version: ${{ env.VERSION }}" >> build_report.txt
echo "Commit: ${{ github.sha }}" >> build_report.txt
echo "Checksums MD5:" >> build_report.txt
md5sum fnsad-${{ env.VERSION }}* | sed 's/^/ /' >> build_report.txt
echo "Checksums SHA256:" >> build_report.txt
sha256sum fnsad-${{ env.VERSION }}* | sed 's/^/ /' >> build_report.txt
- name: Create sha256sum
run: |
sha256sum fnsad-${{ env.VERSION }}* >> sha256sum.txt
- name: Create release note
run: |
cat ./RELEASE_NOTE.md > release_note.txt
echo '' >> release_note.txt
echo '```text' >> release_note.txt
cat ./build_report.txt >> release_note.txt
echo '```' >> release_note.txt
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: ./release_note.txt
draft: true
prerelease: false
- name: Upload sha256sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sha256sum.txt
asset_name: sha256sum.txt
asset_content_type: application/file
- name: Upload linux-amd64 artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./fnsad-${{ env.VERSION }}-linux-amd64
asset_name: fnsad-${{ env.VERSION }}-linux-amd64
asset_content_type: application/binary
- name: Upload linux-arm64 artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./fnsad-${{ env.VERSION }}-linux-arm64
asset_name: fnsad-${{ env.VERSION }}-linux-arm64
asset_content_type: application/binary
- name: Upload compression
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./fnsad-${{ env.VERSION }}.tar.gz
asset_name: fnsad-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip