-
Notifications
You must be signed in to change notification settings - Fork 14
62 lines (59 loc) · 2.33 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
61
62
name: Build and Publish app
on:
push:
branches: dev
jobs:
build:
name: Build app
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build and push to Docker Hub
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
build-args: NOTION_SECRET=${{ secrets.NOTION_TOKEN }}
push: true
cache-from: type=gha
cache-to: type=gha, mode=max
tags: ${{ secrets.DOCKERHUB_ORG }}/landing-page:latest
open-shift:
name: Deploy to OC
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install oc
uses: redhat-actions/[email protected]
- name: Login to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
- name: Create project
run: oc new-project ${{ secrets.OPENSHIFT_NAMESPACE }} || oc project ${{ secrets.OPENSHIFT_NAMESPACE }}
- name: Pull from Docker registry
run: docker pull ${{ secrets.DOCKERHUB_ORG }}/landing-page:latest
- name: Login to Rahti registry
run: sudo docker login -p ${{ secrets.OPENSHIFT_TOKEN }} -u unused docker-registry.rahti.csc.fi
- name: Push to Rahti registry
run: sudo docker tag ${{ secrets.DOCKERHUB_ORG }}/landing-page:latest docker-registry.rahti.csc.fi/${{ secrets.OPENSHIFT_NAMESPACE }}/landing-page:latest && sudo docker push docker-registry.rahti.csc.fi/${{ secrets.OPENSHIFT_NAMESPACE }}/landing-page
- name: Delete app
id: destroy-app
run: oc delete all -l app=landing-page-dev
- name: Create app with route
run: |
oc new-app landing-page --namespace=${{ secrets.OPENSHIFT_NAMESPACE }} --name=landing-page-dev
oc expose svc/landing-page-dev --name=elixir