mirror of
https://github.com/clangd/clangd.git
synced 2025-02-23 17:09:52 +00:00
clangd/actions/pick is currently broken because LLVM no longer has a branch called master. We didn't have any releases for past 3 weeks, i've contacted author in https://github.com/ramasilveyra/last-successful-gh-commit/issues/2.
61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
# Workflow to create an auto-buildable release periodically.
|
|
#
|
|
# Releases created with automation credentials don't trigger workflows.
|
|
# Therefore a token `secrets.RELEASE_TOKEN` must exist with public_repo scope.
|
|
name: Periodic release
|
|
on:
|
|
# Run weekly on sunday at 21:37 UTC (arbitrary)
|
|
schedule:
|
|
- cron: '37 21 * * SUN'
|
|
# Allow triggering manually:
|
|
# curl -XPOST -d '{"event_type":"periodic"}' \
|
|
# "-HAuthorization: Bearer <token>" \
|
|
# https://api.github.com/repos/clangd/clangd/dispatches
|
|
repository_dispatch: { types: periodic }
|
|
jobs:
|
|
# Choose the commit to build a release from.
|
|
#
|
|
# We want to avoid unbuildable revisions: choose the last green from CI.
|
|
# FIXME: the criteria should be some consistent set of buildbots passing.
|
|
pick:
|
|
name: Create draft release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install deps
|
|
run: |
|
|
sudo apt-get install jq
|
|
- name: Clone scripts
|
|
uses: actions/checkout@v2
|
|
# Use clangd/actions/pick after
|
|
# https://github.com/ramasilveyra/last-successful-gh-commit/issues/2 has
|
|
# been addressed.
|
|
- name: Get commit hash for LLVM head
|
|
run: >
|
|
curl --fail --show-error
|
|
"-HAuthorization: Bearer ${{ secrets.RELEASE_TOKEN }}"
|
|
"https://api.github.com/repos/llvm/llvm-project/commits/main" |
|
|
jq ".sha" -r > commit
|
|
- name: Compute release info
|
|
run: |
|
|
echo "RELEASE_COMMIT=$(cat commit)" >> $GITHUB_ENV
|
|
echo "RELEASE_COMMIT_SHORT=$(printf '%.12s' $(cat commit))" >> $GITHUB_ENV
|
|
echo "RELEASE_DATE=$(date -u +%Y%m%d)" >> $GITHUB_ENV
|
|
- name: Create release
|
|
uses: actions/create-release@master
|
|
id: release
|
|
env: { GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" }
|
|
with:
|
|
tag_name: snapshot_${{ env.RELEASE_DATE }}
|
|
release_name: ${{ env.RELEASE_DATE }} @${{ env.RELEASE_COMMIT_SHORT }}
|
|
body: |
|
|
Unstable snapshot of clangd on ${{ env.RELEASE_DATE }}.
|
|
|
|
Built from llvm/llvm-project@${{ env.RELEASE_COMMIT }}.
|
|
prerelease: true
|
|
# It would be nice to use draft releases, to hide them from users.
|
|
# But drafts don't fire events to trigger the autobuild workflow.
|
|
# Instead, that workflow marks the release as draft until it's built.
|
|
# As a result, the empty release will be briefly visible to users.
|
|
draft: false
|
|
|