gha_config 0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +131 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9d19ff5b1e9e5061ace6d37d397e5e7404525d6ce101b74cb9532db251d30b4
|
4
|
+
data.tar.gz: '09ec807d50a2b8c55e50ddc0691a577458a0a62967d540f67402e0c38b39a87a'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d7973193d71d199bf15c9a858e7ab307fe6e6f58d606acdeb26127906f7f1125cf102236f9b62ecfcdb38fbc25548cfce640e33edd6318d1048235de1b9019f3
|
7
|
+
data.tar.gz: cfc3111a028a9bb696b51030aa66b9ccc62146153d312b31bc98f19114b3a18a8e432ad2f68347f09f6a433019aeab613b9bd06d66f8385dd91fca9e12bfb77f
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# gha_config
|
2
|
+
|
3
|
+
This gem will process a templated file and output a GitHub Action workflow file specific to Flipp workflows. The idea is that you can maintain a small, lean config file without a lot of repetition and copy/pasting, and process it to export a "real" workflow file for GitHub to use.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
You will need Ruby 2.3 or greater to run this (most Macs have this preinstalled). Make sure you have the latest version of Rubygems as well.
|
8
|
+
|
9
|
+
Install using `gem install gha_config`.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Create a file called `.github/workflow-src/CI.yml` in the base directory of your app. You can think of this file as a regular GitHub Action workflow file, except for two differences:
|
14
|
+
|
15
|
+
1. Certain "global / always needed" steps and settings do not need to be added, as they will be auto-added after processing.
|
16
|
+
2. The file supports special *template* keys which can be replaced later on.
|
17
|
+
|
18
|
+
Run the command with `gha_config` - it will output the file into `.github/workflows/CI.yml`.
|
19
|
+
|
20
|
+
### Template keys
|
21
|
+
|
22
|
+
Template keys are very similar to [YAML anchors](http://blogs.perl.org/users/tinita/2019/05/reusing-data-with-yaml-anchors-aliases-and-merge-keys.html). Unfortunately GitHub does not support anchors, and in addition anchors have a weakness in that you cannot use them to extend arrays/lists.
|
23
|
+
|
24
|
+
Template keys all begin and end with underscores: `_`. You define template keys in a special `_defaults_` section in your config, and you can use them elsewhere.
|
25
|
+
|
26
|
+
Here's an example of a templated GitHub Action workflow file:
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
on:
|
30
|
+
pull_request:
|
31
|
+
push:
|
32
|
+
branches:
|
33
|
+
- master
|
34
|
+
- develop
|
35
|
+
|
36
|
+
defaults_:
|
37
|
+
_container_:
|
38
|
+
image: ghcr.io/wishabi/ci-build-environment:ruby-3.0-buster-node
|
39
|
+
credentials:
|
40
|
+
username: ${{ github.repository_owner }}
|
41
|
+
password: ${{ secrets.GHCR_TOKEN }}
|
42
|
+
_cache_:
|
43
|
+
- name: Bundle cache
|
44
|
+
uses: actions/cache@v2
|
45
|
+
with:
|
46
|
+
path: vendor/bundle
|
47
|
+
key: rails-${{ hashFiles('Gemfile.lock') }}
|
48
|
+
restore-keys: rails-
|
49
|
+
_teardown_:
|
50
|
+
- name: Slack webhook
|
51
|
+
env:
|
52
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
53
|
+
uses: voxmedia/github-action-slack-notify-build@v2
|
54
|
+
if: failure()
|
55
|
+
_setup_:
|
56
|
+
- _cache_
|
57
|
+
- name: Bundle install
|
58
|
+
run: bundle install --jobs=4
|
59
|
+
|
60
|
+
jobs:
|
61
|
+
build:
|
62
|
+
container: _container_
|
63
|
+
steps:
|
64
|
+
- _setup_
|
65
|
+
- _teardown_
|
66
|
+
```
|
67
|
+
|
68
|
+
The output of this file will look like this:
|
69
|
+
```yaml
|
70
|
+
name: CI
|
71
|
+
|
72
|
+
on:
|
73
|
+
pull_request:
|
74
|
+
push:
|
75
|
+
branches:
|
76
|
+
- master
|
77
|
+
- develop
|
78
|
+
|
79
|
+
env:
|
80
|
+
HOME: /home/circleci
|
81
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
82
|
+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
|
83
|
+
AWS_REGION: ${{ secrets.AWS_REGION }}
|
84
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
85
|
+
DEPLOYMENT_TYPE: ${{ secrets.DEPLOYMENT_TYPE }}
|
86
|
+
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
|
87
|
+
ECS_CLUSTER_PROD: ${{ secrets.ECS_CLUSTER_PROD }}
|
88
|
+
ECS_CLUSTER_STG: ${{ secrets.ECS_CLUSTER_STG }}
|
89
|
+
ECS_SERVICE_PROD: ${{ secrets.ECS_SERVICE_PROD }}
|
90
|
+
ECS_SERVICE_STG: ${{ secrets.ECS_SERVICE_STG }}
|
91
|
+
SERVICE_NAME: ${{ secrets.SERVICE_NAME }}
|
92
|
+
SERVICE_PROFILE: ${{ secrets.SERVICE_PROFILE }}
|
93
|
+
SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
|
94
|
+
WISHABI_ENVIRONMENT: ${{ secrets.WISHABI_ENVIRONMENT }}
|
95
|
+
|
96
|
+
jobs:
|
97
|
+
|
98
|
+
build:
|
99
|
+
runs-on: [ubuntu, runner-fleet]
|
100
|
+
container:
|
101
|
+
image: ghcr.io/wishabi/ci-build-environment:ruby-3.0-buster-node
|
102
|
+
credentials:
|
103
|
+
username: "${{ github.repository_owner }}"
|
104
|
+
password: "${{ secrets.GHCR_TOKEN }}"
|
105
|
+
steps:
|
106
|
+
- name: Checkout code
|
107
|
+
uses: actions/checkout@v2
|
108
|
+
- name: Bundle cache
|
109
|
+
uses: actions/cache@v2
|
110
|
+
with:
|
111
|
+
path: vendor/bundle
|
112
|
+
key: rails-${{ hashFiles('Gemfile.lock') }}
|
113
|
+
restore-keys: rails-
|
114
|
+
- name: Bundle install
|
115
|
+
run: bundle install --jobs=4
|
116
|
+
- name: Slack webhook
|
117
|
+
env:
|
118
|
+
SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
|
119
|
+
uses: voxmedia/github-action-slack-notify-build@v2
|
120
|
+
if: failure()
|
121
|
+
```
|
122
|
+
|
123
|
+
In the future, we will likely auto-add the Flipp "global action" to each job once it's created.
|
124
|
+
|
125
|
+
Templates get expanded into their contents whenever they are used. Templates can also include templates (as you can see that the `setup` template includes the `cache` template). Finally, if a template is used inside a list of steps, the expansion will continue the list rather than nest it.
|
126
|
+
|
127
|
+
You can add this gem to your app Gemfile and re-run it whenever your "source workflow" changes.
|
128
|
+
|
129
|
+
## Contributing
|
130
|
+
|
131
|
+
Pull requests are welcome!
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gha_config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.10'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Orner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Write a longer description. Optional.
|
28
|
+
email:
|
29
|
+
- daniel.orner@flipp.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
homepage: ''
|
36
|
+
licenses: []
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.3'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.2.21
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Process GitHub Action workflow files
|
57
|
+
test_files: []
|