Release SDK #108
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 SDK" | |
on: | |
# no timezone support so cron runs in UTC time for now | |
schedule: | |
- cron: "8 17 * * 1" | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
# SDK release is done from public main branch. | |
confirm-public-repo-main-branch: | |
name: "Confirm release is run from public/main branch" | |
uses: michaeltchuang/.github/.github/workflows/release-branch-context-check.yml@main | |
create-release-branch: | |
name: "Create Release Branch" | |
runs-on: ubuntu-latest | |
needs: confirm-public-repo-main-branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.MICHAELTCHUANG_BOT }} | |
GIT_AUTHOR_NAME: michaeltchuang | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: michaeltchuang | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: "Checkout main branch" | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.MICHAELTCHUANG_BOT }} | |
repository: michaeltchuang/a-day-in-my-bobalife | |
ref: main | |
submodules: recursive | |
- name: "Import GPG Key" | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: "Create and push release branch" | |
run: | | |
git checkout -b release/${{ github.run_number }} | |
git push origin release/${{ github.run_number }} | |
semantic-release: | |
name: "Semantic Release" | |
needs: create-release-branch | |
runs-on: macos-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.MICHAELTCHUANG_BOT }} | |
GIT_AUTHOR_NAME: michaeltchuang | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: michaeltchuang | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: "Checkout main branch" | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.MICHAELTCHUANG_BOT }} | |
fetch-depth: 0 | |
ref: main | |
- name: "Import GPG Key" | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: "Merge release branch into main branch" | |
run: | | |
git pull origin release/${{ github.run_number }} | |
- name: "Semantic Release" | |
working-directory: HaveAMagicalDay | |
run: | | |
npx \ | |
-p lodash \ | |
-p semantic-release@17 \ | |
-p @semantic-release/changelog@5 \ | |
-p @semantic-release/git@9 \ | |
-p @semantic-release/exec@5 \ | |
-p [email protected] \ | |
semantic-release | |
- name: "Push automated release commits to release branch" | |
run: | | |
git push origin HEAD:release/${{ github.run_number }} | |
sync-repository: | |
name: "Sync Repository" | |
needs: semantic-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout main branch" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: ${{ github.repository }} | |
token: ${{ secrets.MICHAELTCHUANG_BOT }} | |
ref: main | |
- name: "Merge release branch into main branch" | |
run: | | |
git pull origin release/${{ github.run_number }} | |
- name: "Push release commits to main branch" | |
run: | | |
git push origin HEAD:main | |
- name: "Delete release branch" | |
run: | | |
git push --delete origin release/${{ github.run_number }} | |