Skip to content

Add permissions for write access in GitHub Actions workflow #8

Add permissions for write access in GitHub Actions workflow

Add permissions for write access in GitHub Actions workflow #8

Workflow file for this run

name: Build and Release
permissions:
contents: write
on:
push:
tags:
- "v*.*.*" # Trigger on version tags
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform }}
override: true
- name: Install cross-compilation tools for ARM
if: matrix.platform == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.platform }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: KeyResolve-${{ matrix.platform }}
path: target/${{ matrix.platform }}/release/KeyResolve
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: ./dist/*
tag: ${{ github.ref_name }}