Skip to content

Merge pull request #57 from YdrMaster/main #28

Merge pull request #57 from YdrMaster/main

Merge pull request #57 from YdrMaster/main #28

Workflow file for this run

name: release
on:
push:
branches:
- main
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
mode: [release, debug]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.mode }}
- name: Build (release mode)
if: matrix.mode == 'release'
run: cargo make
- name: Build (debug mode)
if: matrix.mode == 'debug'
run: cargo make --debug
- name: Compress and Rename Artifact
run: |
gzip -c target/riscv64imac-unknown-none-elf/${{ matrix.mode }}/rustsbi-qemu.bin > rustsbi-qemu-${{ matrix.mode }}.gz
zip rustsbi-qemu-${{ matrix.mode }}.zip target/riscv64imac-unknown-none-elf/${{ matrix.mode }}/rustsbi-qemu.bin
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: rustsbi-qemu-${{ matrix.mode }}
path: |
rustsbi-qemu-${{ matrix.mode }}.gz
rustsbi-qemu-${{ matrix.mode }}.zip
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: List Artifacts
run: ls -R ./artifacts
- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Check if pre-release
id: check
run: |
if [[ $GITHUB_REF =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PRE_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "PRE_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Get Changelog
id: changelog-reader
uses: mindsers/[email protected]
with:
version: ${{ (steps.check.outputs.PRE_RELEASE && 'Unreleased') || github.ref_name }}
- name: Update Unreleased Tag
if: ${{ steps.changelog-reader.outputs.version == 'Unreleased' }}
uses: richardsimko/update-tag@v1
with:
tag_name: Unreleased
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog-reader.outputs.version }}
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
body: ${{ steps.changelog-reader.outputs.changes }}
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
target_commitish: ${{ github.sha }}
files: |
artifacts/**/*