From 0994e71ae2dc7b595833343ca3751b5175111fe4 Mon Sep 17 00:00:00 2001 From: Josh Palmer <1253239+Shfty@users.noreply.github.com> Date: Sun, 23 Apr 2023 04:25:18 +0100 Subject: [PATCH] Add github actions --- .github/workflows/create-tag-release.yml | 44 ++++++++++++++++++++++++ .github/workflows/publish-rust-docs.yml | 11 ++++++ .github/workflows/rust.yml | 22 ++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .github/workflows/create-tag-release.yml create mode 100644 .github/workflows/publish-rust-docs.yml create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/create-tag-release.yml b/.github/workflows/create-tag-release.yml new file mode 100644 index 0000000..623532c --- /dev/null +++ b/.github/workflows/create-tag-release.yml @@ -0,0 +1,44 @@ +name: Release on Tag + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + release: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: read + + name: Generate Release + steps: + - name: checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get previous tag + id: previousTag + run: | + name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1) + echo "previousTag: $name" + echo "previousTag=$name" >> $GITHUB_ENV + + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v4.1.0 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + head-ref: ${{ env.previousTag }} + base-ref: ${{ github.ref_name }} + + - name: Create Release + uses: ncipollo/release-action@v1.12.0 + with: + draft: true + token: ${{ github.token }} + name: "Release ${{ github.ref_name }}" + body: "## Release Notes\n\nTODO\n\n## Commits\n\n${{ steps.changelog.outputs.changelog }}" diff --git a/.github/workflows/publish-rust-docs.yml b/.github/workflows/publish-rust-docs.yml new file mode 100644 index 0000000..df0d494 --- /dev/null +++ b/.github/workflows/publish-rust-docs.yml @@ -0,0 +1,11 @@ +name: Publish Rust Docs +run-name: ${{ github.actor }} is publishing documentation 🚀 +on: + push: + +permissions: + contents: write + +jobs: + publish-cargo-doc: + uses: Shfty/github-actions/.github/workflows/publish-rust-docs.yml@master diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..d54fa2f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose