This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (68 loc) · 2.69 KB
/
branch-imager.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
61
62
63
64
65
66
67
68
69
70
71
name: Branch Imager
on:
push:
branches-ignore:
- main
jobs:
Build:
name: Compiling TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
- name: Add problem matchers
run: echo "::add-matcher::.github/problemMatchers/tsc.json"
- name: Use Node.js v16
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # tag=v3
with:
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Build Code
run: yarn build
- name: Upload Microservice bundle to artifacts
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # tag=v3
with:
name: microservice_bundle
path: dist/
if-no-files-found: error
Publish:
name: Publish image to container registries
runs-on: ubuntu-latest
if: >-
!(contains(github.event.head_commit.message, '[skip docker]'))
needs: Build
steps:
- name: Checkout Project
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
- name: Download build bundle artifact
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v3
with:
name: microservice_bundle
path: dist/
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # renovate: tag=v1.6.0
- name: Login to DockerHub
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 # tag=v1.14.1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 # tag=v1.14.1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get GitHub Branch Name
id: get_branch_name
run: echo ::set-output name=branch_name::$(echo $( [ -z "${{ github.head_ref }}" ] && echo ${{ github.ref }} | cut -c12- || echo ${{ github.head_ref }} ) | sed -e 's/\/\|_/-/g' | sed -e 's/@//g')
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a # tag=v2.10.0
with:
push: true
context: .
tags: |
skyrabot/outflux:${{ steps.get_branch_name.outputs.branch_name }}
ghcr.io/skyra-project/outflux:${{ steps.get_branch_name.outputs.branch_name }}