Create LICENSE (#6) #22
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
name: build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.** | |
merge_group: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- arch: x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
- arch: aarch64-apple-darwin | |
runs-on: macos-latest | |
- arch: x86_64-apple-darwin | |
runs-on: macos-latest | |
- arch: wasm32-wasip2 | |
runs-on: macos-latest | |
skip-test: true | |
ext: .wasm | |
runs-on: ${{ matrix.target.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Prepare target | |
run: rustup target add ${{ matrix.target.arch }} | |
- name: Build | |
run: cargo build --target=${{ matrix.target.arch }} --release --verbose | |
- name: Run tests | |
run: cargo test --target=${{ matrix.target.arch }} --verbose | |
if: ${{ matrix.target.skip-test != true }} | |
- name: Archive csaf-validator (${{ matrix.target.arch }}) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: csaf-validator-${{ matrix.target.arch }} | |
path: target/${{ matrix.target.arch }}/release/csaf-validator${{ matrix.target.ext }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha') | |
steps: | |
- name: Determine Version | |
run: | | |
# determine version from tag | |
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3) | |
if [[ $VERSION != v* ]] | |
then | |
export VERSION="" | |
echo "Building version-less (main or feature branch)" | |
else | |
echo "Building as ${VERSION}" | |
fi | |
# store version in GitHub environment file | |
echo "version=$VERSION" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
with: | |
path: csaf-validator | |
pattern: csaf-validator-* | |
- run: | | |
# zip each folder | |
ls csaf-validator | xargs -I {} zip {}.zip -rj csaf-validator/{} | |
ls csaf-validator-*.zip | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ env.version }} | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
csaf-validator-*.zip |