Skip to content

Added GitHub actions #1

Added GitHub actions

Added GitHub actions #1

Workflow file for this run

name: build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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/csaf-validator
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- 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/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: .
- uses: actions/download-artifact@v4
with:
name: csaf-validator-macos-arm64
path: .
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ env.version }}
draft: false
prerelease: false
files: |
csaf-validator-linux-amd64
csaf-validator-macos-arm64