This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(GITHUB): prefer pure semantic versioning
- Loading branch information
1 parent
6559378
commit 3f928b2
Showing
8 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,26 +99,44 @@ jobs: | |
|
||
steps: | ||
- name: Create Release -- Checkout Repository | ||
if: contains(github.ref, '/tags/v') | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create Release -- Branch Filter | ||
id: branch_filter | ||
run: | | ||
source ./{{cookiecutter.project_slug}}/.github/scripts/branch_filter.sh "${{ github.event.ref }}" | ||
- name: Create Release -- Checkout Repository (All Commits) | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Create Release -- Setup Environment | ||
if: contains(github.ref, '/tags/v') | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
run: | | ||
source ./{{cookiecutter.project_slug}}/.github/scripts/setup.sh | ||
echo "{}" > package.json | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Create Release -- Install Poetry | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
run: | | ||
source ./{{cookiecutter.project_slug}}/.github/scripts/poetry.sh "install-poetry" | ||
- name: Create Release -- Check 'pyproject.toml' Matches Tag | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
run: | | ||
source ./{{cookiecutter.project_slug}}/.github/scripts/version.sh | ||
- name: Create Release -- Generate Changelog | ||
if: contains(github.ref, '/tags/v') | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
run: | ||
source ./{{cookiecutter.project_slug}}/.github/scripts/changelog.sh | ||
|
||
- name: Create Release -- Create Github Release | ||
if: contains(github.ref, '/tags/v') | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -134,7 +152,7 @@ jobs: | |
prerelease: false | ||
|
||
- name: Create Release -- Report Job Status on Success | ||
if: contains(github.ref, '/tags/v') | ||
if: steps.branch_filter.outputs.match == 'TRUE' | ||
run: | | ||
./{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: automated release has been created!\nhttps://github.com/${USERNAME}/${PROJECT_NAME}/releases" | ||
|
@@ -315,8 +333,8 @@ jobs: | |
run: | | ||
cd ${TEMPLATED_NAME} | ||
git checkout master | ||
git tag --delete v0.0.0 # Don't Repush | ||
git tag v1.0.0 | ||
git tag --delete 0.0.0 # Don't Repush | ||
git tag 0.1.0 | ||
- name: Push Test -- Push To Test Repository (master) | ||
uses: ad-m/[email protected] | ||
|
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
25 changes: 25 additions & 0 deletions
25
{{cookiecutter.project_slug}}/.github/scripts/branch_filter.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/branch_filter.sh | ||
# Evaluates if the current git reference is a release candidate. | ||
|
||
# 1: The git reference that created the workflow flow. | ||
|
||
# CI only script. | ||
|
||
set -eo pipefail | ||
|
||
MATCH="FALSE" | ||
|
||
main() { | ||
|
||
if [[ "${1}" =~ ^refs/tags/[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]] && | ||
[[ "${1}" != "refs/tags/0.0.0" ]]; then | ||
MATCH="TRUE" | ||
fi | ||
|
||
echo "match=${MATCH}" >> "${GITHUB_OUTPUT}" | ||
|
||
} | ||
|
||
main "$@" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/version.sh | ||
# Ensures the 'pyproject.toml' version matches the current Git Tag. | ||
|
||
# BRANCH_OR_TAG: The name of the current Git Branch or Tag. | ||
|
||
# CI only script. | ||
|
||
set -eo pipefail | ||
|
||
main() { | ||
|
||
if [[ "$(poetry version -s)" != "${BRANCH_OR_TAG}" ]]; then | ||
echo "The 'pyproject.toml' file does not match the version tag!" | ||
exit 127 | ||
fi | ||
|
||
} | ||
|
||
main "$@" |
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
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