-
Notifications
You must be signed in to change notification settings - Fork 6
60 lines (56 loc) · 1.99 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
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-latest
steps:
- name: workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: prepare
run: |-
apk update
apk add --no-cache python3 py3-pip
find /usr/lib/ -type f -name 'EXTERNALLY-MANAGED' -delete
pip3 install awscli
- uses: actions/checkout@v4
- 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: public.ecr.aws/degica/rails-buildpack:latest
env:
BARCELONA_ENDPOINT: https://barcelona.degica.com
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- 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: '*'