Skip to content
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
COVERAGE_REPORTS: tests-coverage-reports
TEST_RESULTS_DIRECTORY: .
LKG_TAG: ci-lkg

jobs:
### Initialization: retrieve, install and cache dependencies
Expand Down Expand Up @@ -448,3 +449,43 @@ jobs:
with:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
file: ./coverage/cobertura-coverage.xml

lkg-tag:
# LKG = last known good
name: Tag successful build as LKG
runs-on: ubuntu-latest
needs: [tests, smoke-tests]
if: github.repository == 'microsoft/vscode-python'
steps:
- name: Delete existing tag
run: |
curl -s -X DELETE https://api.github.com/repos/microsoft/vscode-python/git/refs/tags/${{env.LKG_TAG}} \
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}"

# We need 2 calls when creating an annotated tag: first create the tag object, then the tag reference.
# If we only wanted a lightweight tag we would only need to create a tag reference.
# See https://developer.github.com/v3/git/tags/#create-a-tag-object
- name: Create a tag object
# Curl syntax explanation: https://stackoverflow.com/a/36778045
run: |
curl -s -X POST "https://api.github.com/repos/microsoft/vscode-python/git/tags" \
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-d @- << EOF
{
"tag": "${{env.LKG_TAG}}",
"message": "Last known good build of vscode-python via the GitHub Action CI workflow",
"object": "${{github.sha}}",
"type": "commit"
}
EOF

- name: Create a tag reference
run: |
curl -s -X POST "https://api.github.com/repos/microsoft/vscode-python/git/refs" \
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-d @- << EOF
{
"ref": "refs/tags/${{env.LKG_TAG}}",
"sha": "${{github.sha}}"
}
EOF