Hopefully now it works #10
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
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-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Build | |
run: cargo build --release --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Archive csaf-validator (linux amd64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: csaf-validator-linux-amd64 | |
path: target/release/csaf-validator | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Build | |
run: cargo build --release --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Archive csaf-validator (macos arm64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: csaf-validator-macos-arm64 | |
path: target/release/csaf-validator | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- build-macos | |
- build-linux | |
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: | |
name: csaf-validator-linux-amd64 | |
path: csaf-validator-linux-amd64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: csaf-validator-macos-arm64 | |
path: csaf-validator-macos-arm64 | |
- run: | | |
# just some magic to make the released files work with multiple platforms | |
mv csaf-validator-linux-amd64/csaf-validator csaf-validator-linux-amd64/csaf-validator-linux-amd64 | |
mv csaf-validator-macos-arm64/csaf-validator csaf-validator-macos-arm64/csaf-validator-macos-arm64 | |
- 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-*/csaf-validator-* |