chore: update permissions in GitHub workflows #10
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 for Ubuntu 22.04 | |
on: | |
workflow_call: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
packages: write | |
attestations: write | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl build-essential debhelper devscripts pkg-config libssl-dev libsqlite3-dev zip | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ubuntu-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/git | |
key: ubuntu-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ubuntu-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Build project | |
run: | | |
DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --release | |
cd target/release | |
zip -r /tmp/ubuntu_amd64_${{ github.event.release.tag_name }}.zip sctgdesk-api-server | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu_amd64 | |
path: | | |
target/release/sctgdesk-api-server | |
- name: Upload Release Assets binaries for Macos amd64 | |
uses: softprops/action-gh-release@v2 | |
continue-on-error: true | |
with: | |
files: | | |
/tmp/ubuntu_amd64_${{ github.event.release.tag_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Assets binaries for ubuntu_amd64 | |
uses: softprops/action-gh-release@v2 | |
continue-on-error: true | |
with: | |
draft: true | |
tag_name: nightly | |
files: | | |
/tmp/ubuntu_amd64.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |