Merge pull request #816 from degica/subdomain-dots #685
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '*' |