diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 208ec4c..4352274 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ -name: Compile +name: Build -on: [push, pull_request] +on: [workflow_call] jobs: build: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 21c739a..76a9124 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,6 +1,6 @@ name: CSharpier formatting check -on: [push, pull_request] +on: [workflow_call] jobs: format-check: diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml new file mode 100644 index 0000000..641f08b --- /dev/null +++ b/.github/workflows/nightly-release.yml @@ -0,0 +1,47 @@ +name: Release + +on: [workflow_call] + +jobs: + release: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - name: Delete previous nightly release + run: | + gh release --repo ${{ github.repository }} delete nightly --cleanup-tag + env: + GH_TOKEN: ${{ github.token }} + continue-on-error: true # In case the release doesn't exist yet + - name: Checkout repo + uses: actions/checkout@v4 + with: + path: src + fetch-depth: 0 + - name: Create nightly tag + run: | + git -C src tag nightly + git -C src push origin nightly + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: bin + - name: Release info + id: release_info + run: | + echo "now=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + echo "message=$(git -C src log -1 --pretty=%s)" >> $GITHUB_OUTPUT + echo 'files<> $GITHUB_OUTPUT + find bin -name '*.tar.gz' >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + - name: Create nightly release + uses: softprops/action-gh-release@v2 + with: + prerelease: true + tag_name: nightly + name: Z64Utils nightly ${{ steps.release_info.outputs.now }} + body: | + Nightly build of Z64Utils + ${{ steps.release_info.outputs.message }} + files: | + ${{ steps.release_info.outputs.files }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..35305ec --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,9 @@ +name: PR + +on: [pull_request] + +jobs: + check-format: + uses: ./.github/workflows/format.yml + build: + uses: ./.github/workflows/build.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..b179fd5 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,12 @@ +name: Push + +on: [push] + +jobs: + check-format: + uses: ./.github/workflows/format.yml + build: + uses: ./.github/workflows/build.yml + nightly-release: + needs: build + uses: ./.github/workflows/nightly-release.yml