From 3fbdb49f6a7f684a7513ddc39b820d8458aa48f4 Mon Sep 17 00:00:00 2001 From: Piotr Galar Date: Thu, 17 Feb 2022 13:25:36 +0100 Subject: [PATCH 1/4] Exit if run was not queued --- entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index e7bd37c..f54f3b1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,6 +37,14 @@ ln -s "${REAL_PLAN_DIR}" "${PLANSHOME}" --metadata-branch "${GITHUB_REF#refs/heads/}" \ --metadata-commit "${GITHUB_SHA}" | tee run.out TGID=$(awk '/run is queued with ID/ {print $10}' Date: Thu, 14 Apr 2022 13:22:15 +0200 Subject: [PATCH 2/4] add release workflows and changelog --- .github/scripts/changelog.sh | 23 +++++++++++++++++++++ .github/workflows/pre-release.yml | 30 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++ CHANGELOG.md | 13 ++++++++++++ 4 files changed, 99 insertions(+) create mode 100755 .github/scripts/changelog.sh create mode 100644 .github/workflows/pre-release.yml create mode 100644 .github/workflows/release.yml create mode 100644 CHANGELOG.md diff --git a/.github/scripts/changelog.sh b/.github/scripts/changelog.sh new file mode 100755 index 0000000..0b00636 --- /dev/null +++ b/.github/scripts/changelog.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +file="./CHANGELOG.md" +regex='^## \[([0-9]+)\.([0-9]+)\.([0-9]+)\] - ([0-9]{4}-[0-9]{2}-[0-9]{2})$' + +version='' +log=() + +while read line; do + if [[ $line =~ $regex ]]; then + if [[ -z "$version" ]]; then + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + version="$major.$minor.$patch" + date="${BASH_REMATCH[4]}" + else + break + fi + elif [[ ! -z "$version" ]]; then + log+=("$line") + fi +done <<< "$(cat "$file")" diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 0000000..03a074d --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,30 @@ +name: Pre Release +on: + pull_request: + paths: [CHANGELOG.md] + branches: [master] +jobs: + Post-Comment: + name: Post Comment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + source .github/scripts/changelog.sh + git fetch origin --tags + if [[ -z "$(git tag -l "v$version")" ]]; then + echo "BODY<> $GITHUB_ENV + echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "TAG=v$version" >> $GITHUB_ENV + fi + shell: bash + - if: ${{ env.TAG != '' }} + uses: marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1 + with: + header: pre-release + recreate: true + message: | + ## ${{ env.TAG }} + + ${{ env.BODY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2cd5d36 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release +on: + workflow_dispatch: + push: + paths: [CHANGELOG.md] + branches: [master] +jobs: + Publish: + name: Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + source .github/scripts/changelog.sh + git fetch origin --tags + if [[ -z "$(git tag -l "v$version")" ]]; then + git tag "v$major.$minor.$patch" + git tag "v$major.$minor" --force + git tag "v$major" --force + git push --tags --force + echo "BODY<> $GITHUB_ENV + echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "TAG=v$version" >> $GITHUB_ENV + fi + shell: bash + - if: ${{ env.TAG != '' }} + uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0 + with: + body: | + ${{ env.BODY }} + tag: ${{ env.TAG }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2f0facc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### Added +- release workflows +- changelog + +### Changed +- the repository from https://github.com/coryschwartz/testground-github-action to https://github.com/testground/testground-github-action From 90b4daad9531e8d77bdcc8587019e30300dc3c09 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 14 Apr 2022 13:30:57 +0200 Subject: [PATCH 3/4] fix release workflows --- .github/workflows/pre-release.yml | 4 ++-- .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 03a074d..6e2ce34 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,5 +1,5 @@ name: Pre Release -on: +on: pull_request: paths: [CHANGELOG.md] branches: [master] @@ -12,7 +12,7 @@ jobs: - run: | source .github/scripts/changelog.sh git fetch origin --tags - if [[ -z "$(git tag -l "v$version")" ]]; then + if [[ ! -z "$version" && -z "$(git tag -l "v$version")" ]]; then echo "BODY<> $GITHUB_ENV echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2cd5d36..92c3274 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - run: | source .github/scripts/changelog.sh git fetch origin --tags - if [[ -z "$(git tag -l "v$version")" ]]; then + if [[ ! -z "$version" && -z "$(git tag -l "v$version")" ]]; then git tag "v$major.$minor.$patch" git tag "v$major.$minor" --force git tag "v$major" --force From 89faab0f9c74e16dd29c1175459e59e17f38ce46 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 14 Apr 2022 13:35:14 +0200 Subject: [PATCH 4/4] release v1.0.0 --- CHANGELOG.md | 2 ++ README.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0facc..b0776dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.0.0] - 2022-04-14 ### Added - release workflows - changelog diff --git a/README.md b/README.md index 438add6..d494ba3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +*NOTE*: This repository was forked from https://github.com/coryschwartz/testground-github-action to continue its' active development (initially to include the following fix: https://github.com/coryschwartz/testground-github-action/pull/2). + # testground-github-action Submit jobs to [testground](https://testground.ai) and view the outcome in Github. @@ -27,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: ${{ matrix.composition_file }} - id: + id: uses: coryschwartz/testground-github-action@v1.0 with: backend_addr: ${{ matrix.backend_addr }}