Update submodule references #60
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 submodule references | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "15 12 * * 1" # At 12:15 on Monday. | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
name: Package and publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Export publish version | |
run: echo "PUBLISH_VERSION=$(date +%Y.%M.%d)" >> $GITHUB_ENV | |
- name: Run the auto-update script | |
run: | | |
# setup the username and email | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
./scripts/auto-update.sh | |
# The original GITHUB_TOKEN has all it needs to create the tag | |
# but when it does, the CI workflow that should run, will not | |
# To workaround this issue, we create a temporary token, with more | |
# permissions to create tag | |
- name: Generate token | |
id: generate-token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: 412514 | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create tag | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ steps.generate-token.outputs.token }} | |
script: | | |
const { PUBLISH_VERSION } = process.env | |
const tag = `v${PUBLISH_VERSION}`; | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${tag}`, | |
sha: context.sha | |
}) |