From 46af0868c7f6fdaba2417d7fae392738d5f0408a Mon Sep 17 00:00:00 2001 From: Marcus Rossel Date: Wed, 22 Jan 2025 13:48:00 +0100 Subject: [PATCH] Add GitHub action for creating releases --- .github/workflows/ci.yml | 24 ++++++------------ .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfd2410..0faafee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: build & test +name: Build and Test on: push: branches: @@ -6,28 +6,20 @@ on: pull_request: merge_group: -permissions: - contents: write - jobs: - build: - name: build and test code + build-and-test: + name: Build and Test runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v3 - - name: Install elan run: | set -o pipefail curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y - ~/.elan/bin/lean --version + "$HOME/.elan/bin/lean" --version echo "$HOME/.elan/bin" >> $GITHUB_PATH - - - name: Compile Library - run: | - lake build - + - name: Build Library + run: lake build - name: Run Tests - run: | - lake test -- ci + run: lake test -- ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a5f5541 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Create Release +on: + # Allows this workflow to be run manually from the "Actions" tab. + workflow_dispatch: + inputs: + release-tag: + type: string + description: Release Tag + +# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token +permissions: + contents: write + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: "${{ github.event.inputs.release-tag }}" + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Create Tag and Release + run: | + git tag "$TAG" + git push origin "$TAG" + gh release create "$TAG" --repo="$GITHUB_REPOSITORY" --title="$TAG" + upload-artifacts: + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#about-matrix-strategies + strategy: + matrix: + # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#standard-github-hosted-runners-for-public-repositories + os: [macos-latest, macos-13, ubuntu-24.04-arm, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Install elan + run: | + set -o pipefail + curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y + "$HOME/.elan/bin/lean" --version + echo "$HOME/.elan/bin" >> $GITHUB_PATH + - name: Build Library + run: lake build + - name: Upload Artifacts + run: lake upload "${{ github.event.inputs.release-tag }}" \ No newline at end of file