Skip to content

Commit

Permalink
Merge pull request #7 from p5/chore-release-gha-workflow
Browse files Browse the repository at this point in the history
chore: create GitHub Actions workflow for building binaries
  • Loading branch information
albertofaria authored Jan 22, 2024
2 parents 77517d2 + 8367d58 commit c29ec55
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
name:
description: 'Release name'
required: true
default: 'v0.0.0'
is-prerelease:
description: 'Is this a pre-release?'
required: true
type: boolean
default: true

jobs:
release:
runs-on: ubuntu-latest
container: fedora:39
permissions:
contents: write
steps:
# Dependencies must be installed before the checkout step, otherwise the
# .git directory will be missing and tag creation will fail.
- name: Install Dependencies
run: |
echo "Installing workflow dependencies"
dnf install -y git cargo
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: cargo build --release

- name: Upload to Workflow
if: github.event_name != 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: crun-vm
path: target/release/

- name: Create Tag
if: github.event_name == 'workflow_dispatch'
run: |
echo "Creating tag"
git config --global --add safe.directory /__w/crun-vm/crun-vm
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git tag -a ${{ github.event.inputs.name }} -m "Release ${{ github.event.inputs.name }} from ${{ github.sha }}"
git push origin ${{ github.event.inputs.name }}
- name: Release
if: github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v1
with:
name: ${{ github.event.inputs.name }}
tag_name: ${{ github.event.inputs.name }}
prerelease: ${{ github.event.inputs.is-prerelease }}
files: |
target/release/crun-vm
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c29ec55

Please sign in to comment.