-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (72 loc) · 3.18 KB
/
_release.yml
File metadata and controls
75 lines (72 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Release
on:
workflow_call:
inputs:
cache_mode:
type: string
default: download
secrets:
SEMANTIC_RELEASE_SLACK_WEBHOOK:
required: true
TXO_GITHUB_BOT_APP_ID:
required: true
TXO_GITHUB_BOT_APP_PRIVATE_KEY:
required: true
permissions:
id-token: write
contents: write
jobs:
release:
name: "/"
runs-on: ubuntu-latest
environment: default-branch-semantic-release
steps:
- uses: technology-studio/github-workflows/.github/actions/github-app-token-generator@696ee6d68a8fdb357c5a6e26e748fba32f09a9bb # main
id: get-token
with:
app-id: ${{ secrets.TXO_GITHUB_BOT_APP_ID }}
private-key: ${{ secrets.TXO_GITHUB_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- uses: technology-studio/github-workflows/.github/actions/install-dependencies@696ee6d68a8fdb357c5a6e26e748fba32f09a9bb # main
id: install
with:
use-cache: false
- run: yarn test --coverage
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
- name: Update eslint-ci-rules if needed
if: ${{ contains(github.event.head_commit.message, 'update dependency eslint-config-txo') || contains(github.event.head_commit.message, 'update eslint txo packages') }}
run: |
if ! yarn lint:ci; then
echo "Linting failed. Updating eslint-ci-rules.json..."
yarn txo-eslint update-ci-rules
changed_files=$(git diff --name-only)
if [[ "$changed_files" == "eslint-ci-rules.json" ]]; then
git config --global user.email "txo-github-bot[bot]@users.noreply.github.com"
git config --global user.name "TXO GitHub Bot[bot]"
git remote set-url origin https://x-access-token:${{ steps.get-token.outputs.token }}@github.com/${{ github.repository }}
git add eslint-ci-rules.json
git commit -m "chore: update eslint-ci-rules.json [skip ci]"
git push
fi
else
echo "Linting passed. No update needed."
fi
- run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ steps.get-token.outputs.token }}
SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
- uses: technology-studio/github-workflows/.github/actions/save-dependencies@696ee6d68a8fdb357c5a6e26e748fba32f09a9bb # main
with:
cache_mode: ${{ inputs.cache_mode }}
download-cache-dir: ${{ steps.install.outputs.download-cache-dir }}
download-cache-primary-key: ${{ steps.install.outputs.download-cache-primary-key }}
node-modules-primary-key: ${{ steps.install.outputs.node-modules-primary-key }}
- name: Send a Slack message on failure
if: failure()
uses: technology-studio/github-workflows/.github/actions/slack-failed-job-message@696ee6d68a8fdb357c5a6e26e748fba32f09a9bb # main
with:
slack_bot_token: ${{ secrets.TXO_SLACK_BOT_APP_TOKEN }}
channel_id: ${{ secrets.TXO_SLACK_GITHUB_OPS_CHANNEL_ID }}