-
-
Notifications
You must be signed in to change notification settings - Fork 9
155 lines (131 loc) · 4.08 KB
/
main.yml
File metadata and controls
155 lines (131 loc) · 4.08 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CI/CD
on:
push:
branches: [ main ]
paths-ignore:
- '*.md'
pull_request:
branches: [ main ]
paths-ignore:
- '*.md'
workflow_dispatch:
inputs:
release:
description: Create release
required: false
type: boolean
env:
RUBY_VER: 2.6
concurrency:
group: ci/cd-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
if: github.event_name != 'workflow_dispatch'
uses: ./.github/workflows/codeql-analysis.yml
permissions:
actions: read
contents: read
security-events: write
ci:
name: Run Tests
runs-on: macos-latest
outputs:
release: ${{ steps.check_version_bump.outputs.release_type != '' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VER }}
- name: Install dependencies
run: |
bundle config deployment true
bundle install
- name: Run tests
run: bundle exec rake specs
- name: Install Flutter
uses: subosito/flutter-action@v2.10.0
- name: Setup Flutter for ios
run: |
flutter precache --ios
- name: Test example app
run: bundle exec rake demo
- name: Check version bump
id: check_version_bump
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ github.token }}
default_bump: false
dry_run: true
cd:
name: Build and Publish
if: (github.event_name == 'push' && needs.ci.outputs.release == 'true') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')
needs: [ci, analyze]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '17'
- name: Setup action config
run: npm install
working-directory: .github/config
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VER }}
- name: Install dependencies
run: |
bundle config deployment true
bundle install
- name: Conventional Changelog Action
id: conventional_changelog
uses: TriPSs/conventional-changelog-action@v4
with:
github-token: ${{ github.token }}
git-message: 'chore(CHANGELOG): update for {version}'
git-user-name: ${{ github.actor }}
git-user-email: soumya.mahunt@gmail.com
skip-version-file: true
release-count: 0
pre-changelog-generation: '.github/config/pre_changelog_hook.js'
config-file-path: '.github/config/config.js'
- name: Build gem
if: steps.conventional_changelog.outputs.skipped == 'false'
run: gem build *.gemspec
- name: Publish to GitHub Package Registry
if: steps.conventional_changelog.outputs.skipped == 'false'
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
GITHUB_TOKEN: ${{ github.token }}
OWNER: ${{ github.repository_owner }}
- name: Publish to RubyGems
if: steps.conventional_changelog.outputs.skipped == 'false'
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push *.gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
- name: Create GitHub Release
if: steps.conventional_changelog.outputs.skipped == 'false'
uses: ncipollo/release-action@v1
with:
token: ${{ github.token }}
tag: ${{ steps.conventional_changelog.outputs.tag }}
body: ${{ steps.conventional_changelog.outputs.changelog }}
artifacts: '*.gem'