generated from giantswarm/python-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7686a8d
commit f2a3e40
Showing
10 changed files
with
94 additions
and
70 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
architect: giantswarm/architect@4.26.0 | ||
architect: giantswarm/architect@4.31.0 | ||
codecov: codecov/[email protected] | ||
|
||
workflows: | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl@5.12.0 | ||
# devctl@6.11.0 | ||
# | ||
name: Create Release | ||
on: | ||
|
@@ -15,7 +15,7 @@ on: | |
jobs: | ||
debug_info: | ||
name: Debug info | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Print github context JSON | ||
run: | | ||
|
@@ -24,7 +24,7 @@ jobs: | |
EOF | ||
gather_facts: | ||
name: Gather facts | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
project_go_path: ${{ steps.get_project_go_path.outputs.path }} | ||
ref_version: ${{ steps.ref_version.outputs.refversion }} | ||
|
@@ -53,7 +53,7 @@ jobs: | |
echo "version=${version}" >> $GITHUB_OUTPUT | ||
- name: Checkout code | ||
if: ${{ steps.get_version.outputs.version != '' }} | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Get project.go path | ||
id: get_project_go_path | ||
if: ${{ steps.get_version.outputs.version != '' }} | ||
|
@@ -84,26 +84,26 @@ jobs: | |
echo "refversion=${refversion}" >> $GITHUB_OUTPUT | ||
update_project_go: | ||
name: Update project.go | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
if: ${{ needs.gather_facts.outputs.version != '' && needs.gather_facts.outputs.project_go_path != '' && needs.gather_facts.outputs.ref_version != 'true' }} | ||
needs: | ||
- gather_facts | ||
steps: | ||
- name: Install architect | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "architect" | ||
version: "6.1.0" | ||
version: "6.11.0" | ||
- name: Install semver | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "semver" | ||
version: "3.2.0" | ||
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz" | ||
tarball_binary_path: "*/src/${binary}" | ||
smoke_test: "${binary} --version" | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Update project.go | ||
id: update_project_go | ||
env: | ||
|
@@ -122,22 +122,22 @@ jobs: | |
fi | ||
- name: Set up git identity | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "taylorbot" | ||
- name: Commit changes | ||
run: | | ||
file="${{ needs.gather_facts.outputs.project_go_path }}" | ||
git add $file | ||
git commit -m "Bump version to ${{ steps.update_project_go.outputs.new_version }}" | ||
- name: Push changes | ||
env: | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git" | ||
branch: "${{ github.ref }}-version-bump" | ||
run: | | ||
git push "${REMOTE_REPO}" HEAD:${{ env.branch }} | ||
- name: Create PR | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
base: "${{ github.ref }}" | ||
branch: "${{ github.ref }}-version-bump" | ||
version: "${{ needs.gather_facts.outputs.version }}" | ||
|
@@ -146,15 +146,15 @@ jobs: | |
hub pull-request -f -m "${{ env.title }}" -b ${{ env.base }} -h ${{ env.branch }} -r ${{ github.actor }} | ||
create_release: | ||
name: Create release | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- gather_facts | ||
if: ${{ needs.gather_facts.outputs.version }} | ||
outputs: | ||
upload_url: ${{ steps.create_gh_release.outputs.upload_url }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.sha }} | ||
- name: Ensure correct version in project.go | ||
|
@@ -171,44 +171,44 @@ jobs: | |
path: ./CHANGELOG.md | ||
- name: Set up git identity | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "taylorbot" | ||
- name: Create tag | ||
run: | | ||
version="${{ needs.gather_facts.outputs.version }}" | ||
git tag "v$version" ${{ github.sha }} | ||
- name: Push tag | ||
env: | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | ||
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git" | ||
run: | | ||
git push "${REMOTE_REPO}" --tags | ||
- name: Create release | ||
id: create_gh_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
with: | ||
body: ${{ steps.changelog_reader.outputs.changes }} | ||
tag_name: "v${{ needs.gather_facts.outputs.version }}" | ||
release_name: "v${{ needs.gather_facts.outputs.version }}" | ||
|
||
create-release-branch: | ||
name: Create release branch | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- gather_facts | ||
if: ${{ needs.gather_facts.outputs.version }} | ||
steps: | ||
- name: Install semver | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "semver" | ||
version: "3.0.0" | ||
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz" | ||
tarball_binary_path: "*/src/${binary}" | ||
smoke_test: "${binary} --version" | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Clone the whole history, not just the most recent commit. | ||
- name: Fetch all tags and branches | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# DO NOT EDIT. Generated with: | ||
# | ||
# devctl@5.12.0 | ||
# devctl@6.11.0 | ||
# | ||
name: Create Release PR | ||
on: | ||
|
@@ -30,7 +30,7 @@ on: | |
jobs: | ||
debug_info: | ||
name: Debug info | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Print github context JSON | ||
run: | | ||
|
@@ -39,12 +39,12 @@ jobs: | |
EOF | ||
gather_facts: | ||
name: Gather facts | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
repo_name: ${{ steps.gather_facts.outputs.repo_name }} | ||
branch: ${{ steps.gather_facts.outputs.branch }} | ||
base: ${{ steps.gather_facts.outputs.base }} | ||
is_major: ${{ steps.gather_facts.outputs.is_major }} | ||
needs_major_bump: ${{ steps.gather_facts.outputs.needs_major_bump }} | ||
skip: ${{ steps.pr_exists.outputs.skip }} | ||
version: ${{ steps.gather_facts.outputs.version }} | ||
steps: | ||
|
@@ -65,8 +65,20 @@ jobs: | |
version="$(echo $head | awk -F# '{print $NF}')" | ||
if [[ $version =~ ^major|minor|patch$ ]]; then | ||
gh auth login --with-token <<<$(echo -n ${{ secrets.GITHUB_TOKEN }}) | ||
version_parts=($(gh api "repos/${{ github.repository }}/releases/latest" --jq '.tag_name[1:] | split(".") | .[0], .[1], .[2]')) | ||
gh auth login --with-token <<<$(echo -n ${{ secrets.TAYLORBOT_GITHUB_ACTION }}) | ||
gh_api_get_latest_release_version() | ||
{ | ||
if ! version="$(gh api "repos/$1/releases/latest" --jq '.tag_name[1:] | split(".") | .[0], .[1], .[2]')" | ||
then | ||
case "$version" in | ||
*Not\ Found*) echo Assuming v0.0.0, hooray first release! >&2 ; version="0 0 0" ;; | ||
*) version="" ; return 1 ;; | ||
esac | ||
fi | ||
echo "$version" | ||
} | ||
version_parts=($(gh_api_get_latest_release_version "${{ github.repository }}")) | ||
version_major=${version_parts[0]} | ||
version_minor=${version_parts[1]} | ||
version_patch=${version_parts[2]} | ||
|
@@ -82,7 +94,9 @@ jobs: | |
version_major=$((version_major+1)) | ||
version_minor=0 | ||
version_patch=0 | ||
echo "is_major=true" >> $GITHUB_OUTPUT | ||
if [[ "${version_major}" != "1" ]]; then | ||
echo "needs_major_bump=true" >> $GITHUB_OUTPUT | ||
fi | ||
;; | ||
*) | ||
echo "Unknown Semver level provided" | ||
|
@@ -97,8 +111,8 @@ jobs: | |
version_patch=$(echo "${version}" | cut -d "." -f 3) | ||
# This will help us detect versions with suffixes as majors, i.e 3.0.0-alpha1. | ||
# Even though it's a pre-release, it's still a major. | ||
if [[ $version_minor = 0 && $version_patch =~ ^0.* ]]; then | ||
echo "is_major=true" >> $GITHUB_OUTPUT | ||
if [[ $version_minor = 0 && $version_patch =~ ^0.* && $version_major != 1 ]]; then | ||
echo "needs_major_bump=true" >> $GITHUB_OUTPUT | ||
fi | ||
fi | ||
repo_name="$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" | ||
|
@@ -110,17 +124,19 @@ jobs: | |
- name: Check if PR exists | ||
id: pr_exists | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
run: | | ||
if gh pr view --repo ${{ github.repository }} ${{ steps.gather_facts.outputs.branch }} | grep -i 'state:[[:space:]]*open' >/dev/null; then | ||
gh pr view --repo ${{ github.repository }} ${{ steps.gather_facts.outputs.branch }} | ||
head="${{ steps.gather_facts.outputs.branch }}" | ||
branch="${head#refs/heads/}" # Strip "refs/heads/" prefix. | ||
if gh pr view --repo "${{ github.repository }}" "${branch}" --json state --jq .state | grep -i 'open' > /dev/null; then | ||
gh pr view --repo "${{ github.repository }}" "${branch}" | ||
echo "skip=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "skip=false" >> $GITHUB_OUTPUT | ||
fi | ||
create_release_pr: | ||
name: Create release PR | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- gather_facts | ||
if: ${{ needs.gather_facts.outputs.skip != 'true' }} | ||
|
@@ -131,12 +147,12 @@ jobs: | |
with: | ||
go-version: '=1.18.1' | ||
- name: Install architect | ||
uses: giantswarm/install-binary-action@v1.0.0 | ||
uses: giantswarm/install-binary-action@v1.1.0 | ||
with: | ||
binary: "architect" | ||
version: "6.1.0" | ||
version: "6.11.0" | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.gather_facts.outputs.branch }} | ||
- name: Prepare release changes | ||
|
@@ -186,14 +202,14 @@ jobs: | |
- name: Bump go module defined in go.mod if needed | ||
run: | | ||
if [ "${{ needs.gather_facts.outputs.is_major }}" = true ] && test -f "go.mod"; then | ||
go install github.com/marwan-at-work/mod/cmd/mod@v0.4.2 | ||
if [ "${{ needs.gather_facts.outputs.needs_major_bump }}" = true ] && test -f "go.mod"; then | ||
go install github.com/marwan-at-work/mod/cmd/mod@v0.5.0 | ||
mod upgrade | ||
fi | ||
- name: Set up git identity | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "taylorbot" | ||
- name: Create release commit | ||
env: | ||
version: "${{ needs.gather_facts.outputs.version }}" | ||
|
@@ -202,12 +218,12 @@ jobs: | |
git commit -m "Release v${{ env.version }}" | ||
- name: Push changes | ||
env: | ||
remote_repo: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | ||
remote_repo: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git" | ||
run: | | ||
git push "${remote_repo}" HEAD:${{ needs.gather_facts.outputs.branch }} | ||
- name: Create PR | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}" | ||
base: "${{ needs.gather_facts.outputs.base }}" | ||
version: "${{ needs.gather_facts.outputs.version }}" | ||
run: | | ||
|
Oops, something went wrong.