Merge pull request #27 from nilwurtz/dependabot/maven/com.thoughtwork… #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- .github/** | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'True to release' | |
required: true | |
type: boolean | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- uses: getgauge/setup-gauge@master | |
- name: Run test | |
run: mvn clean test | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: check | |
if: ${{ contains(github.event.head_commit.message, ':rocket:') || github.event.inputs.release == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: package | |
run: | | |
ignored="! -path $(pwd) " | |
for i in $(cat .templateignore); do | |
ignored+="! -name $i " | |
done | |
files=$(find $(pwd) -maxdepth 1 $ignored) | |
mkdir kotlin_maven | |
cp -r $files ./kotlin_maven | |
zip -r -X kotlin_maven.zip ./kotlin_maven; | |
openssl sha256 kotlin_maven.zip | cut -d " " -f2 > kotlin_maven.zip.sha256 | |
- name: check deploy | |
run: | | |
wget -O current.sha256 https://github.com/nilwurtz/gauge-kotlin-maven/releases/latest/download/kotlin_maven.zip.sha256 | |
! diff current.sha256 kotlin_maven.zip.sha256 | |
- name: version | |
id: version | |
run: | | |
VERSION=$(jq -r ".version" metadata.json) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.version.outputs.version }} | |
name: Release v${{ steps.version.outputs.version }} | |
files: | | |
kotlin_maven.zip | |
kotlin_maven.zip.sha256 | |
- name: bump up version | |
run: | | |
git clean -dfx | |
version=$(jq -r ".version" metadata.json | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | |
echo $(jq -r ".version = \"$version\"" metadata.json) | jq . > new_metadata.json | |
cat new_metadata.json > metadata.json | |
git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
git add metadata.json | |
git commit -m ":up: Bumped version to $version" | |
git push "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" main | |