Create test build onto the update/108-nodejs-v20-github-actions-external-only branch by @eason9487 #10
Workflow file for this run
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
name: GitHub Actions - Create Test Build | |
run-name: Create test build onto the ${{ github.ref_name }} branch by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
jobs: | |
CreateTestBuild: | |
name: Create Test Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare node | |
uses: ./packages/github-actions/actions/prepare-node | |
with: | |
node-version: 20 | |
cache-dependency-path: ./packages/github-actions/package-lock.json | |
install-deps: "no" | |
- name: Create and commit test build | |
run: | | |
REPO_URL="${{ github.server_url }}/${{ github.repository }}" | |
BRANCH_NAME="${{ github.ref_name }}" | |
TEST_BRANCH_NAME="${BRANCH_NAME}-test-build" | |
.github/scripts/github-actions-create-and-commit-build.sh "$REPO_URL" "$BRANCH_NAME" | |
# This `git checkout HEAD^` is to prevent errors from the post jobs like "Prepare node". | |
git checkout HEAD^ -- ./packages/github-actions/actions | |
# Set/update the test branch | |
git push --force origin "HEAD:refs/heads/${TEST_BRANCH_NAME}" | |
# Set summary | |
echo "### :link: The test build has been created" >> $GITHUB_STEP_SUMMARY | |
echo "${REPO_URL}/tree/${TEST_BRANCH_NAME}" >> $GITHUB_STEP_SUMMARY | |
echo "### :zap: Use the test build" >> $GITHUB_STEP_SUMMARY | |
echo "In the repo where you want to test custom actions with this test build, specify the \`uses\` with \`${{ github.repository }}/ACTION_PATH_TO_BE_TESTED@${TEST_BRANCH_NAME}\`." >> $GITHUB_STEP_SUMMARY |