ksandermann is UPDATING 🚀 #241
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: Update Versions | |
run-name: ${{ github.actor }} is UPDATING 🚀 | |
on: | |
schedule: | |
#UTC - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
- cron: '20 3 * * MON' | |
- cron: '20 3 * * FRI' | |
jobs: | |
Clean-Repo: | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get current date | |
run: echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Fetch origin | |
run: git fetch origin | |
- name: Checkout master | |
run: git checkout master | |
- name: Delete local branches | |
run: git checkout -b "tmp" || true && git checkout master && git for-each-ref --format '%(refname:short)' refs/heads | grep -v "master\|main" | xargs git branch -D | |
- name: Pull origin | |
run: git pull origin master | |
Create-Branch: | |
needs: Clean-Repo | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Get current date | |
run: echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Create branch | |
run: git checkout -b ${{ env.RELEASE_DATE }}_automation | |
Update-Versions: | |
needs: Create-Branch | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: update versions | |
run: bash update_versions.sh | |
Commit: | |
needs: Update-Versions | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Get current date | |
run: echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Commit | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-actions[bot]" | |
git commit --allow-empty -a -m "Release ${{ env.RELEASE_DATE }}" | |
Push-Changes: | |
needs: Commit | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Get current date | |
run: echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.RELEASE_DATE }}_automation | |
Create-PR: | |
needs: Push-Changes | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Get current date | |
run: echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: create PR | |
run: | | |
curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/ksandermann/cloud-toolbox/pulls \ | |
-d '{"title":"Release ${{ env.RELEASE_DATE }}","body":"# Changelog","head":"${{ env.RELEASE_DATE }}_automation","base":"master"}' |