diff --git a/.github/workflows/check_branch.yml b/.github/workflows/check_branch.yml new file mode 100644 index 00000000..fdd3d245 --- /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: ElsLommelen/actions/protocol_check@protocols + with: + GITHUB_PAT: ${{ secrets.PAT }} 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 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 diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml new file mode 100644 index 00000000..a78f3edf --- /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: ElsLommelen/actions/protocol_website@protocols + with: + GITHUB_PAT: ${{ secrets.PAT }} + GITHUB_REPOSITORY_DEST: "ElsLommelen/protocols" diff --git a/.github/workflows/update_branch.yml b/.github/workflows/update_branch.yml new file mode 100644 index 00000000..c8a90fbe --- /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: ElsLommelen/actions/protocol_update@protocols + with: + GITHUB_PAT: ${{ secrets.PAT }}