-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (130 loc) · 3.96 KB
/
default.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
name: Default
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version: [3.1.4, 3.2.3, 3.3.0]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby-version }}
- name: Lint
run: bundle exec rubocop
- name: Test
run: bundle exec rspec
- name: Notify slack on failure
# if: failure()
if: ${{ matrix.ruby-version == '3.1.4' }}
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.BEPLAT_PUBLIC_REPOS_SLACK_TOKEN }}
with:
channel-id: ${{ vars.DEVELOPER_TOOLS_ALERTS_SLACK_CHANNEL }}
payload: |
{
"text": "GitHub Action failed ${{ github.event.head_commit.url }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Job Failed. :red_circle:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Workflow*: "
},
{
"type": "mrkdwn",
"text": "*Job*: ${{ env.GITHUB_JOB }}"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project*:\n${{ env.GITHUB_REPOSITORY }}"
},
{
"type": "mrkdwn",
"text": "*Branch*:\n${{ env.GITHUB_REF_NAME }}"
},
{
"type": "mrkdwn",
"text": "*Author*:\n${{ env.GITHUB_ACTOR }}"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Job"
},
"url": "${{ env.GITHUB_WORKFLOW_RUN_URL }}"
}
]
}
]
}
release:
name: Release
if: github.ref_name == 'main'
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for version bump
id: version-check
run: |
if git diff --quiet HEAD^ -- lib/static_collection/version.rb; then
echo "Version did not change"
echo "version_changed=false" >> $GITHUB_OUTPUT
else
echo "Version did change"
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
- uses: ruby/setup-ruby@v1
if: steps.version-check.outputs.version_changed == 'true'
with:
bundler-cache: true
- name: Release the gem
if: steps.version-check.outputs.version_changed == 'true'
run: |
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:github: Bearer ${GITHUB_TOKEN}
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
git config user.email "[email protected]"
git config user.name "Wolfbot"
bundle exec rake release
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}