From 10e160c51fc9a661af59062b12ad72a0ceef8bae Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 16:57:47 +0200 Subject: [PATCH 1/6] add GHA to checkprotocol --- .github/workflows/check_branch.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/check_branch.yml diff --git a/.github/workflows/check_branch.yml b/.github/workflows/check_branch.yml new file mode 100644 index 00000000..88b40daa --- /dev/null +++ b/.github/workflows/check_branch.yml @@ -0,0 +1,20 @@ +name: Check the protocol on pull request + +on: + pull_request: + types: [synchronize, opened, reopened, edited] #en zie https://github.com/actions/runner/issues/980 + branches: + - main + +jobs: + run_if: + if: startsWith(github.head_ref, 's[fioap]p-') + runs-on: ubuntu-latest + name: "check protocol" + env: + GITHUB_PAT: ${{ secrets.PAT }} + steps: + - name: Check protocol + uses: inbo/actions/protocol_check@master + with: + GITHUB_PAT: ${{ secrets.PAT }} From d5f5d3e9ae4906b5749ff11951e9f98fcd3f2773 Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 17:15:32 +0200 Subject: [PATCH 2/6] add GHA to update .zenodo.json and NEWS.md --- .github/workflows/update_branch.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/update_branch.yml diff --git a/.github/workflows/update_branch.yml b/.github/workflows/update_branch.yml new file mode 100644 index 00000000..f537522d --- /dev/null +++ b/.github/workflows/update_branch.yml @@ -0,0 +1,20 @@ +name: Update protocol (.zenodo.json and NEWS.md) + +on: + pull_request_review: + types: [submitted] + branches: + - main + +jobs: + run_if: + if: ${{ (github.event.review.state == 'approved') && (startsWith(github.head_ref, 's[fioap]p-')) }} + runs-on: ubuntu-latest + name: "update protocol" + env: + GITHUB_PAT: ${{ secrets.PAT }} + steps: + - name: Update protocol + uses: inbo/actions/protocol_update@master + with: + GITHUB_PAT: ${{ secrets.PAT }} From aeeefce2db48e777af164907d16252d1d15bdfc0 Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 17:16:56 +0200 Subject: [PATCH 3/6] add GHA to publish website on inbo/protocols --- .github/workflows/update-website.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/update-website.yml diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml new file mode 100644 index 00000000..049c3d2a --- /dev/null +++ b/.github/workflows/update-website.yml @@ -0,0 +1,19 @@ +name: On merge to main, build the protocol and add it to the website + +on: + push: + branches: + - main + +jobs: + build-website: + runs-on: ubuntu-latest + name: "add protocol to website" + env: + GITHUB_PAT: ${{ secrets.PAT }} + steps: + - name: Checkout repo + uses: inbo/actions/protocol_website@master + with: + GITHUB_PAT: ${{ secrets.PAT }} + GITHUB_REPOSITORY_DEST: "inbo/protocols" From 9e34f7edede7552a71b9a30150d098babac8be45 Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 17:19:07 +0200 Subject: [PATCH 4/6] add GHA to release protocol --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..31c6b7b2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - 'protocols-****.**' + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Get tag message + run: | + TAG_BODY=$(git tag --contains ${{ github.sha }} -n100 | awk '(NR>1)') + echo "::set-output name=TAG_BODY::$TAG_BODY" + id: tag-body + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: ${{ steps.tag-body.outputs.TAG_BODY }} + draft: false + prerelease: false From 924f29211fe6252dac8a98d89a156edae2c71f1f Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 17:48:43 +0200 Subject: [PATCH 5/6] add GHA to check a branch without protocol --- .../workflows/check_maintenance_branch.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/check_maintenance_branch.yml diff --git a/.github/workflows/check_maintenance_branch.yml b/.github/workflows/check_maintenance_branch.yml new file mode 100644 index 00000000..d4f5fe21 --- /dev/null +++ b/.github/workflows/check_maintenance_branch.yml @@ -0,0 +1,23 @@ +name: Check branch without protocol + +on: + pull_request: + types: [synchronize, opened, reopened, edited] + branches: + - main + +jobs: + run_if: + if: !startsWith(github.head_ref, 's[fioap]p-') + runs-on: ubuntu-latest + name: "check branch without protocol" + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Check where changes are made + run: | + CHANGED=$(git diff --name-only main | grep -v NEWS\.md | grep -v \.zenodo\.json| grep -v ^src/) + if [ -n "${CHANGED}" ]; then + echo '\nBranch '$GITHUB_HEAD_REF' contains changes in protocols. Please make a branch named after the protocol_code to add changes to a protocol. Protocol specific files:' $CHANGED + exit 1 + fi From b431e59782654562860691e52f202f57f888ec0f Mon Sep 17 00:00:00 2001 From: ElsLommelen Date: Mon, 10 Oct 2022 17:57:16 +0200 Subject: [PATCH 6/6] adapt GHA for use in fork --- .github/workflows/check_branch.yml | 2 +- .github/workflows/update-website.yml | 4 ++-- .github/workflows/update_branch.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_branch.yml b/.github/workflows/check_branch.yml index 88b40daa..fdd3d245 100644 --- a/.github/workflows/check_branch.yml +++ b/.github/workflows/check_branch.yml @@ -15,6 +15,6 @@ jobs: GITHUB_PAT: ${{ secrets.PAT }} steps: - name: Check protocol - uses: inbo/actions/protocol_check@master + uses: ElsLommelen/actions/protocol_check@protocols with: GITHUB_PAT: ${{ secrets.PAT }} diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml index 049c3d2a..a78f3edf 100644 --- a/.github/workflows/update-website.yml +++ b/.github/workflows/update-website.yml @@ -13,7 +13,7 @@ jobs: GITHUB_PAT: ${{ secrets.PAT }} steps: - name: Checkout repo - uses: inbo/actions/protocol_website@master + uses: ElsLommelen/actions/protocol_website@protocols with: GITHUB_PAT: ${{ secrets.PAT }} - GITHUB_REPOSITORY_DEST: "inbo/protocols" + GITHUB_REPOSITORY_DEST: "ElsLommelen/protocols" diff --git a/.github/workflows/update_branch.yml b/.github/workflows/update_branch.yml index f537522d..c8a90fbe 100644 --- a/.github/workflows/update_branch.yml +++ b/.github/workflows/update_branch.yml @@ -15,6 +15,6 @@ jobs: GITHUB_PAT: ${{ secrets.PAT }} steps: - name: Update protocol - uses: inbo/actions/protocol_update@master + uses: ElsLommelen/actions/protocol_update@protocols with: GITHUB_PAT: ${{ secrets.PAT }}