-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (55 loc) · 1.93 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
name: build
jobs:
build:
container:
image: docker:git
env:
BARCELONA_ENDPOINT: https://barcelona.degica.com
DOCKER_REPOSITORY: public.ecr.aws/degica/barcelona
DOCKER_BUILDKIT: '1'
runs-on: ubuntu-22.04
steps:
- name: workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: prepare
run: |-
apk add --no-cache python3 py3-pip
pip3 install --upgrade pip
pip3 install awscli
- uses: actions/checkout@v3
- name: setup
run: git submodule update --init
- name: script
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |-
if [[ ${GITHUB_REF##*/} == 'master' ]]; then
IMAGE_TAG=$GITHUB_SHA # git SHA for staging/production deployments
else
IMAGE_TAG=${GITHUB_REF##*/} # branch name for dev usecases
fi
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/degica
docker build . -t $DOCKER_REPOSITORY:$IMAGE_TAG --build-arg git_revision=$IMAGE_TAG --pull
docker images
docker push $DOCKER_REPOSITORY:$IMAGE_TAG
deploy:
container:
image: degica/rails-buildpack:2.6.5-stretch
env:
BARCELONA_ENDPOINT: https://barcelona.degica.com
runs-on: ubuntu-22.04
needs: [build]
steps:
- uses: actions/checkout@v3
- name: deploy_setup
if: github.ref == 'refs/heads/master'
run: |-
curl -L -o bcn.zip https://github.com/degica/barcelona-cli/releases/latest/download/bcn_linux_amd64.zip
unzip ./bcn.zip && mv ./bcn /usr/bin/bcn
- name: deploy_script
if: github.ref == 'refs/heads/master'
run: bcn deploy -q -e production --tag $GITHUB_SHA --heritage-token ${{ secrets.MAINLINE_HERITAGE_TOKEN }}
'on':
push:
branches: '*'