Skip to content

Commit be8110f

Browse files
committed
Migrate circleci to github actions
1 parent f39642f commit be8110f

File tree

4 files changed

+57
-55
lines changed

4 files changed

+57
-55
lines changed

.circleci/config.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Push Merkle Rewards Worker Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
environment: docker
12+
env:
13+
DOCKER_IMAGE: hopprotocol/merkle-drop-framework
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Build application Docker image
22+
uses: docker/build-push-action@v5
23+
with:
24+
context: ./backend/
25+
file: ./backend/Dockerfile
26+
build-args: GIT_REV=${{ github.sha }}
27+
tags: app
28+
load: true
29+
push: false
30+
31+
- name: Login to Docker Hub
32+
uses: docker/login-action@v3
33+
with:
34+
username: ${{ secrets.DOCKER_USER }}
35+
password: ${{ secrets.DOCKER_PASS }}
36+
37+
- name: Push Merkle Rewards Worker Docker image to Docker Hub
38+
run: |
39+
BRANCH=${GITHUB_REF##*/}
40+
BRANCH=$(echo $BRANCH | sed 's/\//-/g')
41+
docker tag app $DOCKER_IMAGE:${{ github.sha }}
42+
docker tag app $DOCKER_IMAGE:$BRANCH
43+
docker push $DOCKER_IMAGE:${{ github.sha }}
44+
docker push $DOCKER_IMAGE:$BRANCH
45+
if [ "$BRANCH" == "master" ]; then
46+
docker tag app $DOCKER_IMAGE:latest
47+
docker push $DOCKER_IMAGE:latest
48+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
1
3+
.secrets

backend/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,11 @@ Instructions to run discourse locally with Docker, for testing discourse auto-po
4545
To generate api key:
4646

4747
Preferences -> Admin -> Manage Keys -> New API Key
48+
49+
## Github Actions
50+
51+
Run github action build locally with [act](https://github.com/nektos/act):
52+
53+
```sh
54+
(cd ../../ && act --workflows .github/workflows/build.yml)
55+
```

0 commit comments

Comments
 (0)