Trigger deployment (#1057) #195
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: Delete feature | |
on: | |
pull_request: | |
types: | |
- unlabeled | |
- closed | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
delete-feature-tags: | |
if: contains(github.event.label.name, 'feature') || contains(github.event.pull_request.labels.*.name, 'feature') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout jumper-exchange | |
uses: actions/checkout@v4 | |
- name: Set app name | |
run: | | |
NAME=$(echo "${{ env.BRANCH_NAME }}" | tr -d -c '[:alnum:]' | tr '[:upper:]' '[:lower:]') | |
echo "APP_NAME=feat-${NAME:0:25}" >> $GITHUB_ENV | |
- name: Generate a token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout helm charts | |
uses: actions/checkout@v4 | |
with: | |
repository: lifinance/lifi-deployment | |
ssh-key: ${{ secrets.DEPLOY_SSH }} | |
ref: develop | |
path: lifi-deployment | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install node dependencies | |
shell: bash | |
run: yarn add yaml | |
- name: Update application deployment | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { default: init } = await import('${{ github.workspace }}/.github/scripts/delete-feature.mjs') | |
await init() | |
- name: push changes | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
git config --global user.name "lifi-bot-action[bot]" | |
git config --global user.email "160733936+lifi-bot-action[bot]@users.noreply.github.com" | |
cd lifi-deployment | |
git commit -m "[bot][jumper] delete feature branch: ${{ env.APP_NAME }}" | |
git push |