mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-11 22:49:54 +00:00
Fix workflow issues (#44230)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
---
|
||||
name: Post-release
|
||||
|
||||
on:
|
||||
@@ -28,9 +29,11 @@ jobs:
|
||||
# to determine it another way.
|
||||
- name: Determine release latest flag and version
|
||||
id: artifacts
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
CURRENT_RELEASE_ID: ${{ github.event.release.node_id }}
|
||||
run: |
|
||||
LATEST_RELEASE_ID=$(gh release view --json id -q .id)
|
||||
CURRENT_RELEASE_ID=${{ github.event.release.node_id }}
|
||||
|
||||
if [ "$LATEST_RELEASE_ID" == "$CURRENT_RELEASE_ID" ]; then
|
||||
echo "type=latest" >> "$GITHUB_OUTPUT"
|
||||
@@ -39,8 +42,6 @@ jobs:
|
||||
fi
|
||||
|
||||
echo "version=$(make -s print-version)" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
update-ami-ids:
|
||||
name: Update AMI IDs
|
||||
@@ -58,8 +59,9 @@ jobs:
|
||||
steps:
|
||||
- name: Get Release Branch
|
||||
id: get-branch
|
||||
env:
|
||||
TAG: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
TAG=${{ github.event.release.tag_name }}
|
||||
BRANCH="branch/$(echo -n $TAG | cut -d '.' -f 1)"
|
||||
MAJOR=${BRANCH#"branch/v"} # trim the 'branch/v' prefix
|
||||
VERSION=${TAG#"v"} # trim the leading v to get just the version
|
||||
@@ -80,6 +82,13 @@ jobs:
|
||||
ref: ${{ steps.get-branch.outputs.branch }}
|
||||
|
||||
- name: Make PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
MAJOR_VERSION: ${{ steps.get-branch.outputs.major }}
|
||||
FULL_VERSION: ${{ steps.get-branch.outputs.version }}
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
BASE_BRANCH: ${{ steps.get-branch.outputs.branch }}
|
||||
REVIEWER: ${{ github.event.release.author.login }}
|
||||
run: |
|
||||
BRANCH_NAME="release-auto-branch-$(date +%s)"
|
||||
git config --global user.email "[email protected]"
|
||||
@@ -87,8 +96,8 @@ jobs:
|
||||
|
||||
# update versions in docs/config.json
|
||||
# for docker images replace version number after <docker image name>:
|
||||
jq --arg major ${{ steps.get-branch.outputs.major }} \
|
||||
--arg version ${{ steps.get-branch.outputs.version }} \
|
||||
jq --arg major "${MAJOR_VERSION}" \
|
||||
--arg version "${FULL_VERSION}" \
|
||||
'.variables.teleport.major_version |= $major |
|
||||
.variables.teleport.version |= $version |
|
||||
.variables.teleport.plugin.version |= $version |
|
||||
@@ -102,11 +111,9 @@ jobs:
|
||||
|
||||
git add docs/config.json
|
||||
git switch -c $BRANCH_NAME
|
||||
git commit -am "[auto] docs: Update version to ${{ github.event.release.tag_name }}"
|
||||
git commit -am "[auto] docs: Update version to ${TAG_NAME}"
|
||||
git push --set-upstream origin $BRANCH_NAME
|
||||
gh pr create --fill --base=${{ steps.get-branch.outputs.branch }} \
|
||||
gh pr create --fill "--base=${BASE_BRANCH}" \
|
||||
--label=automated --label=documentation --label=no-changelog \
|
||||
--reviewer=${{ github.event.release.author.login }}
|
||||
"--reviewer=${REVIEWER}"
|
||||
echo "Docs PR: $(gh pr view --json url --jq .url)" >> "$GITHUB_STEP_SUMMARY"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
name: Update AMI IDs
|
||||
|
||||
on:
|
||||
@@ -47,10 +48,12 @@ jobs:
|
||||
role-session-name: "gha-update-ami-ids-${{ github.run_number }}"
|
||||
|
||||
- name: Update AMI IDs and create PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
PR_REVIEWER: ${{ github.event.release.author.login }}
|
||||
run: |
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "GitHub"
|
||||
TELEPORT_VERSION=${{ inputs.version }} AMI_PR_REVIEWER=${{ github.event.release.author.login }} make -C assets/aws create-update-pr
|
||||
make -C assets/aws create-update-pr "TELEPORT_VERSION=${VERSION}" "AMI_PR_REVIEWER=${PR_REVIEWER}"
|
||||
echo "AMI PR: $(gh pr view --json url --jq .url)" >> "$GITHUB_STEP_SUMMARY"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
name: Deploy Vercel Preview
|
||||
permissions:
|
||||
# Required in order to comment on PRs with a deployment link
|
||||
@@ -8,7 +9,9 @@ env:
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths: ['docs/**']
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- .github/workflows/vercel-preview.yaml
|
||||
types: [opened, reopened, synchronize]
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -26,11 +29,13 @@ jobs:
|
||||
with:
|
||||
repository: 'gravitational/docs'
|
||||
- name: Configure Submodules
|
||||
env:
|
||||
BRANCH: ${{ steps.extract_branch.outputs.branch }}
|
||||
# Edit config.json and .gitmodules so there is a single submodule
|
||||
# pointing to the version of the docs to deploy to the preview site.
|
||||
run: |
|
||||
git rm content/*
|
||||
git submodule add --force -b ${{ steps.extract_branch.outputs.branch }} https://github.com/gravitational/teleport content/preview
|
||||
git submodule add --force -b "${BRANCH}" https://github.com/gravitational/teleport content/preview
|
||||
echo "{\"versions\": [{\"name\": \"preview\", \"branch\": \"preview\", \"deprecated\": false, \"latest\": true}]}" > config.json
|
||||
git submodule update --init --remote --progress
|
||||
- name: Install Vercel CLI
|
||||
@@ -46,11 +51,15 @@ jobs:
|
||||
preview_url="$(cat deployment-url.txt)"
|
||||
echo "PREVIEW_URL=$preview_url" >> $GITHUB_OUTPUT
|
||||
- uses: actions/github-script@v7
|
||||
env:
|
||||
PREVIEW_URL: ${{ steps.deploy.outputs.PREVIEW_URL }}
|
||||
with:
|
||||
script: |
|
||||
const previewUrl = process.env.PREVIEW_URL
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '🤖 Vercel preview here: ${{ steps.deploy.outputs.PREVIEW_URL }}/docs/ver/preview'
|
||||
body: `🤖 Vercel preview here: ${previewUrl}/docs/ver/preview`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user