octoforce-actions/.github/workflows/issue-branch-creation-handl...

97 строки
3.4 KiB
YAML
Исходник Постоянная ссылка Обычный вид История

2022-11-14 20:30:02 +03:00
# This workflow runs when a branch is created
2022-11-16 01:27:26 +03:00
name: Issue Branch Creation Handler
2022-11-14 19:00:43 +03:00
on: create
2022-11-14 18:48:39 +03:00
jobs:
create-sandboxes:
2022-11-14 18:48:39 +03:00
runs-on: ubuntu-latest
steps:
- name: Checkout
2022-11-16 01:05:57 +03:00
uses: actions/checkout@v2.5.0
2022-11-14 18:48:39 +03:00
with:
token: ${{ secrets.SCOPED_PAT }}
- name: Setup Node
2022-11-16 01:05:57 +03:00
uses: actions/setup-node@v3.5.1
2022-11-14 18:48:39 +03:00
with:
2023-02-07 18:39:53 +03:00
node-version-file: ".nvmrc"
2022-11-14 18:48:39 +03:00
- name: Cache node modules
2022-11-16 01:05:57 +03:00
uses: actions/cache@v3.0.11
2022-11-14 18:48:39 +03:00
id: npm_cache_id
with:
path: node_modules
key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-cache-
${{ runner.os }}-
- name: Install Dependencies
if: steps.npm_cache_id.outputs.cache-hit != 'true'
run: npm ci
- name: Filter branch
id: branchFilter
env:
ISSUE_PREFIX: ${{ vars.ISSUE_BRANCH_PREFIX }}
2022-11-18 22:34:28 +03:00
run: node ./node-scripts/branch-filter.js
2022-11-14 18:48:39 +03:00
- name: Check Release Branch
id: releaseFilter
2022-11-18 01:35:45 +03:00
if: vars.GENERATE_RELEASE == 'true'
env:
2022-11-18 22:42:34 +03:00
ISSUE_PREFIX: ${{ vars.RELEASE_BRANCH_PREFIX }}
2022-11-18 22:34:28 +03:00
run: node ./node-scripts/branch-filter.js
2022-11-14 18:48:39 +03:00
- name: Authenticate DevHub
if: steps.branchFilter.outputs.matches == 'true'
run: |
2022-11-14 19:10:38 +03:00
echo "${{ secrets.SALESFORCE_JWT_KEY }}" > server.key
2023-02-07 18:39:53 +03:00
npx sfdx-cli force:auth:jwt:grant \
2022-11-14 19:10:38 +03:00
--clientid ${{ secrets.SALESFORCE_CLIENT_ID }} \
--jwtkeyfile server.key \
2022-11-18 22:51:20 +03:00
--username ${{ secrets.SALESFORCE_DEVHUB_USERNAME }} \
2022-11-14 19:10:38 +03:00
--setdefaultdevhubusername -a DevHub
rm server.key
2022-11-14 18:58:44 +03:00
- name: Extract Branch Name
2022-11-14 18:48:39 +03:00
if: steps.branchFilter.outputs.matches == 'true'
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
2022-11-14 18:58:44 +03:00
- name: Create Dev Sandbox
2022-11-14 18:48:39 +03:00
if: steps.branchFilter.outputs.matches == 'true'
2024-01-19 19:23:23 +03:00
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}
2022-11-14 18:48:39 +03:00
run: |
set +e
npx sf env create sandbox --clone Template \
--name is${{ steps.branchFilter.outputs.issueNumber }} \
2024-01-19 19:23:23 +03:00
--alias $BRANCH \
2022-11-14 18:48:39 +03:00
--target-org DevHub --async --no-prompt
if [ $? -eq 68 ]
then
exit 0
else
exit $?
fi
2022-11-14 18:58:44 +03:00
- name: Create UAT Sandbox
2022-11-14 18:48:39 +03:00
if: steps.branchFilter.outputs.matches == 'true'
2024-01-19 19:23:23 +03:00
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}
2022-11-14 18:48:39 +03:00
run: |
set +e
npx sf env create sandbox --clone Template \
--name is${{ steps.branchFilter.outputs.issueNumber }}uat \
2024-01-19 19:23:23 +03:00
--alias ${BRANCH}-uat \
2022-11-14 18:48:39 +03:00
--target-org DevHub --async --no-prompt
if [ $? -eq 68 ]
then
exit 0
else
exit $?
fi
2022-11-14 18:58:44 +03:00
- name: Delete Old Artifacts
2022-11-18 01:35:45 +03:00
if: vars.GENERATE_RELEASE == 'true' && steps.releaseFilter.outputs.matches == 'true'
2022-11-14 18:48:39 +03:00
run: |
git rm release-notes/release.md || true
git pull
2022-11-14 18:58:44 +03:00
- name: Commit Artifact Deletion
2022-11-18 01:35:45 +03:00
if: vars.GENERATE_RELEASE == 'true' && steps.releaseFilter.outputs.matches == 'true'
2022-11-14 18:48:39 +03:00
uses: stefanzweifel/git-auto-commit-action@75802d269e7721b5146d08f6063ba3097c55ad2b
with:
branch: ${{ github.ref }}
commit_message: Clear old release notes