From 2a25b9386d1da9fd217b56dcfad44f5dbb8640b0 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Tue, 1 Aug 2023 20:24:50 +0200 Subject: [PATCH] Add CI --- .github/workflows/admin.yml | 19 ++++++++++++++ .github/workflows/main.yml | 27 ++++++++++++++++++++ .github/workflows/publish.yml | 47 +++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/workflows/admin.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/admin.yml b/.github/workflows/admin.yml new file mode 100644 index 0000000..aa4092c --- /dev/null +++ b/.github/workflows/admin.yml @@ -0,0 +1,19 @@ +name: Repo Admin +on: + push: + branches: [ main ] + paths: + - doc/* + - src/*/*.scala +jobs: + admin: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Tidy repository + uses: propensive/tumult@0.5.0 + - name: Autocommit changes + uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8c611cc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Build +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Setup Java 19 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '19' + - name: Get Wrath + uses: actions/checkout@v3 + with: + repository: 'propensive/wrath' + path: 'wrath' + ref: '0.5.0' + - name: Build + run: "wrath/wrath -F -x" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fb02025 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,47 @@ +name: Publish +on: + push: + tags: + - 'pending/*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + fetch-depth: 0 + - name: Setup Java 11 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + - name: Fetch tags + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Get Version + id: tagName + run: echo ::set-output name=version::${GITHUB_REF#refs/tags/pending/} + - name: 'Abort if tag exists' + id: checkTagged + shell: bash + run: git show-ref --tags --verify --quiet -- "refs/tags/release/${{ steps.tagName.outputs.version }}" && exit 1 || exit 0 + - name: Publish + run: echo Publishing + - name: Tag release + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.RELEASE_TOKEN }} + script: | + let newRef = context.ref.replace('pending', 'release'); + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: newRef, + sha: context.sha + }); + github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.ref.substring(5) + });