Skip to content

Commit 2e4df1e

Browse files
authored
Merge pull request #1 from testground/release
Release
2 parents 7dbfde2 + 89faab0 commit 2e4df1e

File tree

6 files changed

+112
-1
lines changed

6 files changed

+112
-1
lines changed

.github/scripts/changelog.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
file="./CHANGELOG.md"
4+
regex='^## \[([0-9]+)\.([0-9]+)\.([0-9]+)\] - ([0-9]{4}-[0-9]{2}-[0-9]{2})$'
5+
6+
version=''
7+
log=()
8+
9+
while read line; do
10+
if [[ $line =~ $regex ]]; then
11+
if [[ -z "$version" ]]; then
12+
major="${BASH_REMATCH[1]}"
13+
minor="${BASH_REMATCH[2]}"
14+
patch="${BASH_REMATCH[3]}"
15+
version="$major.$minor.$patch"
16+
date="${BASH_REMATCH[4]}"
17+
else
18+
break
19+
fi
20+
elif [[ ! -z "$version" ]]; then
21+
log+=("$line")
22+
fi
23+
done <<< "$(cat "$file")"

.github/workflows/pre-release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Pre Release
2+
on:
3+
pull_request:
4+
paths: [CHANGELOG.md]
5+
branches: [master]
6+
jobs:
7+
Post-Comment:
8+
name: Post Comment
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- run: |
13+
source .github/scripts/changelog.sh
14+
git fetch origin --tags
15+
if [[ ! -z "$version" && -z "$(git tag -l "v$version")" ]]; then
16+
echo "BODY<<EOF" >> $GITHUB_ENV
17+
echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV
18+
echo "EOF" >> $GITHUB_ENV
19+
echo "TAG=v$version" >> $GITHUB_ENV
20+
fi
21+
shell: bash
22+
- if: ${{ env.TAG != '' }}
23+
uses: marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1
24+
with:
25+
header: pre-release
26+
recreate: true
27+
message: |
28+
## ${{ env.TAG }}
29+
30+
${{ env.BODY }}

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
paths: [CHANGELOG.md]
6+
branches: [master]
7+
jobs:
8+
Publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- run: |
14+
source .github/scripts/changelog.sh
15+
git fetch origin --tags
16+
if [[ ! -z "$version" && -z "$(git tag -l "v$version")" ]]; then
17+
git tag "v$major.$minor.$patch"
18+
git tag "v$major.$minor" --force
19+
git tag "v$major" --force
20+
git push --tags --force
21+
echo "BODY<<EOF" >> $GITHUB_ENV
22+
echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV
23+
echo "EOF" >> $GITHUB_ENV
24+
echo "TAG=v$version" >> $GITHUB_ENV
25+
fi
26+
shell: bash
27+
- if: ${{ env.TAG != '' }}
28+
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
29+
with:
30+
body: |
31+
${{ env.BODY }}
32+
tag: ${{ env.TAG }}
33+
token: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [1.0.0] - 2022-04-14
10+
### Added
11+
- release workflows
12+
- changelog
13+
14+
### Changed
15+
- the repository from https://github.com/coryschwartz/testground-github-action to https://github.com/testground/testground-github-action

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
*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).
2+
13
# testground-github-action
24

35
Submit jobs to [testground](https://testground.ai) and view the outcome in Github.
@@ -27,7 +29,7 @@ jobs:
2729
steps:
2830
- uses: actions/checkout@v2
2931
- name: ${{ matrix.composition_file }}
30-
id:
32+
id:
3133
uses: coryschwartz/[email protected]
3234
with:
3335
backend_addr: ${{ matrix.backend_addr }}

entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ ln -s "${REAL_PLAN_DIR}" "${PLANSHOME}"
3737
--metadata-branch "${GITHUB_REF#refs/heads/}" \
3838
--metadata-commit "${GITHUB_SHA}" | tee run.out
3939
TGID=$(awk '/run is queued with ID/ {print $10}' <run.out)
40+
41+
# Make sure the we received a run ID
42+
if [ -z "$TGID" ]
43+
then
44+
echo "${OUTPUT_OUTCOME}failure/not_queued"
45+
exit "${FAILURE}"
46+
fi
47+
4048
echo "${OUTPUT_ID}${TGID}"
4149

4250
echo "Got testground ID ${TGID}"

0 commit comments

Comments
 (0)