-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (46 loc) · 1.72 KB
/
build.yml
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
name: Build and Publish
on: [push]
jobs:
lint:
name: Lint Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: npm i
- run: npm test
build_and_publish:
needs: lint
name: Build and publish Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build image
run: docker build -t gcp-ruby .
- name: Test Ruby
run: docker run gcp-ruby bash -c "which ruby || exit 1"
- name: Test Bundler
run: docker run gcp-ruby bash -c "which bundle || exit 1"
- name: Test Google Cloud SDK
run: docker run gcp-ruby bash -c "which gcloud || exit 1"
- name: Test Node.js
run: docker run gcp-ruby bash -c "which node || exit 1"
- name: Test Yarn
run: docker run gcp-ruby bash -c "which yarn || exit 1"
- name: Test Chrome
run: docker run gcp-ruby bash -c "which google-chrome || exit 1"
- name: Test Docker
run: docker run gcp-ruby bash -c "which docker || exit 1"
- name: Docker login
run: |
echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Publish latest
run: |
docker tag gcp-ruby savingsutd/gcp-ruby:latest &&
docker push savingsutd/gcp-ruby:latest
if: success() && github.ref == 'refs/heads/main'
- name: Publish release
run: |
export RELEASE_TAG=$(echo $GITHUB_REF | sed -e 's,.*/\(.*\),\1,') &&
docker tag gcp-ruby savingsutd/gcp-ruby:$RELEASE_TAG &&
docker push savingsutd/gcp-ruby:$RELEASE_TAG
if: success() && contains(github.ref, 'refs/tags')