forked from rust-lang/rust-clippy
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
1 changed file
with
54 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Auto Tag | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 31 1 *' | ||
|
||
env: | ||
NEXT_TAG: '41' | ||
SSH_REPO: '[email protected]:${{ github.repository }}.git' | ||
|
||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
repository: 'rust-lang/rust' | ||
ref: '1.${{ env.NEXT_TAG }}.0' | ||
path: 'rust' | ||
- name: Get Clippy commit | ||
working-directory: rust | ||
run: | | ||
git submodule init src/tools/clippy | ||
CLIPPY_SHA=$(git submodule status -- src/tools/clippy | grep -o '\s[0-9a-f]*\s' | tr -d '[:space:]') | ||
echo "::set-env name=CLIPPY_SHA::$CLIPPY_SHA" | ||
- name: Set SSH deploy key | ||
run: | | ||
eval "$(ssh-agens -s)" | ||
ssh-add - <<< ${{ secrets.DEPLOY_KEY }} | ||
- name: Tag Clippy commit | ||
run: | | ||
git checkout $CLIPPY_SHA | ||
git tag 'rust-1.$NEXT_TAG.0' | ||
git push $SSH_REPO --tags | ||
- name: Update GHA Auto Tag | ||
run: | | ||
git checkout master | ||
TIME=$(date -u +%s) | ||
let NEXT_RELEASE="$TIME+6*7*24*60*60" | ||
DATE=$(date -u --date="@$NEXT_RELEASE" +%-d\ %-m) | ||
CRON="0 0 $DATE *" | ||
sed -i "s/cron: '[0-9* ]*'/cron: '$CRON'/" .github/workflows/tag.yml | ||
let NEW_TAG="$NEXT_TAG+1" | ||
sed -i "s/NEXT_TAG: '[0-9]*'/NEXT_TAG: '$NEW_TAG'/" .github/workflows/tag.yml | ||
git add .github/workflows/tag.yml | ||
git commit -m "Update GHA tag workflow" | ||
git push $SSH_REPO |