Skip to content

Commit

Permalink
Merge pull request #1 from testground/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
galargh authored Apr 18, 2022
2 parents 7dbfde2 + 89faab0 commit 2e4df1e
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -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")"
30 changes: 30 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -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 "$version" && -z "$(git tag -l "v$version")" ]]; then
echo "BODY<<EOF" >> $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 }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 "$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
git push --tags --force
echo "BODY<<EOF" >> $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 }}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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]

## [1.0.0] - 2022-04-14
### Added
- release workflows
- changelog

### Changed
- the repository from https://github.com/coryschwartz/testground-github-action to https://github.com/testground/testground-github-action
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -27,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: ${{ matrix.composition_file }}
id:
id:
uses: coryschwartz/[email protected]
with:
backend_addr: ${{ matrix.backend_addr }}
Expand Down
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}' <run.out)

# Make sure the we received a run ID
if [ -z "$TGID" ]
then
echo "${OUTPUT_OUTCOME}failure/not_queued"
exit "${FAILURE}"
fi

echo "${OUTPUT_ID}${TGID}"

echo "Got testground ID ${TGID}"
Expand Down

0 comments on commit 2e4df1e

Please sign in to comment.