Skip to content

Commit 7fbd614

Browse files
authored
Tag GHA CI successful build as LKG (microsoft#10099)
* Prep for testing the workflow while working on it * Don't need any job to test tag pushing * Alright let's try it * Forgot the syntax for multiline commands lol * Try removing slashes * Indentation? * Change the way we refer to the sha * Remove unnecessary document pipe * Remove extra comma * Delete the tag, i don't want it on my fork lol * No need for checkout step * Uncomment conditions + run tagging on main repo * Forgot to undo testing changes, clarify comments
1 parent dc0ed96 commit 7fbd614

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
1717
COVERAGE_REPORTS: tests-coverage-reports
1818
TEST_RESULTS_DIRECTORY: .
19+
LKG_TAG: ci-lkg
1920

2021
jobs:
2122
### Initialization: retrieve, install and cache dependencies
@@ -448,3 +449,43 @@ jobs:
448449
with:
449450
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
450451
file: ./coverage/cobertura-coverage.xml
452+
453+
lkg-tag:
454+
# LKG = last known good
455+
name: Tag successful build as LKG
456+
runs-on: ubuntu-latest
457+
needs: [tests, smoke-tests]
458+
if: github.repository == 'microsoft/vscode-python'
459+
steps:
460+
- name: Delete existing tag
461+
run: |
462+
curl -s -X DELETE https://api.github.com/repos/microsoft/vscode-python/git/refs/tags/${{env.LKG_TAG}} \
463+
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}"
464+
465+
# We need 2 calls when creating an annotated tag: first create the tag object, then the tag reference.
466+
# If we only wanted a lightweight tag we would only need to create a tag reference.
467+
# See https://developer.github.com/v3/git/tags/#create-a-tag-object
468+
- name: Create a tag object
469+
# Curl syntax explanation: https://stackoverflow.com/a/36778045
470+
run: |
471+
curl -s -X POST "https://api.github.com/repos/microsoft/vscode-python/git/tags" \
472+
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
473+
-d @- << EOF
474+
{
475+
"tag": "${{env.LKG_TAG}}",
476+
"message": "Last known good build of vscode-python via the GitHub Action CI workflow",
477+
"object": "${{github.sha}}",
478+
"type": "commit"
479+
}
480+
EOF
481+
482+
- name: Create a tag reference
483+
run: |
484+
curl -s -X POST "https://api.github.com/repos/microsoft/vscode-python/git/refs" \
485+
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
486+
-d @- << EOF
487+
{
488+
"ref": "refs/tags/${{env.LKG_TAG}}",
489+
"sha": "${{github.sha}}"
490+
}
491+
EOF

0 commit comments

Comments
 (0)