Upgrade Gradle #46
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: Deploy App | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
build-server: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Authenticate package registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin | |
- name: Get tag | |
run: echo "BUILD_TAG=$(git describe --tags)" >> $GITHUB_ENV | |
- name: Build and tag image | |
run: docker build -f server/Dockerfile -t ghcr.io/dellisd/reroute-server:${BUILD_TAG} -t ghcr.io/dellisd/reroute-server:dev . | |
- name: Push image | |
if: success() | |
run: docker push --all-tags ghcr.io/dellisd/reroute-server | |
build-client: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Secrets | |
env: | |
MAPBOX_KEY: ${{ secrets.MAPBOX_KEY }} | |
run: echo "mapbox.key=$MAPBOX_KEY" >> local.properties | |
- name: Authenticate package registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin | |
- name: Get tag | |
run: echo "BUILD_TAG=$(git describe --tags)" >> $GITHUB_ENV | |
- name: Build and tag image | |
run: docker build -f web/Dockerfile -t ghcr.io/dellisd/reroute-client:${BUILD_TAG} -t ghcr.io/dellisd/reroute-client:dev . | |
- name: Push image | |
if: success() | |
run: docker push --all-tags ghcr.io/dellisd/reroute-client | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [build-server, build-client] | |
steps: | |
- name: Deploy 🚉 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }} | |
script: | | |
docker pull ghcr.io/dellisd/reroute-server:dev | |
docker pull ghcr.io/dellisd/reroute-client:dev | |
docker stack deploy -c ${{ secrets.DOCKER_DEPLOY_PATH }}/docker-compose.yml reroute --with-registry-auth |