Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
feat: new deployment strategy (#255)
Browse files Browse the repository at this point in the history
* Remove release from deploy workflow

* Add new release workflow

* Fix typo

* Check if any changes to commit

* Check with branch event

* Commit API_VERSION

* Add router deployment

* Make ready for tags

* Simplify and add API to message
  • Loading branch information
wpf500 authored Apr 26, 2023
1 parent 3438577 commit 4214823
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy

on:
push:
branches: ["master", "dev", "release"]
branches: ["master", "dev"]

jobs:
init:
Expand All @@ -19,9 +19,6 @@ jobs:
refs/heads/dev)
echo "stage=dev" >> $GITHUB_OUTPUT
;;
refs/heads/release)
echo "stage=release" >> $GITHUB_OUTPUT
;;
esac
check:
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release

on:
push:
tags:
- v*

jobs:
check:
uses: ./.github/workflows/check.yml

push:
runs-on: ubuntu-latest
needs: [check]

outputs:
version: ${{ fromJSON(steps.app_meta.outputs.json).labels['org.opencontainers.image.version'] }}

steps:
- uses: actions/checkout@v3

- id: app_meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
${{ secrets.DOCKER_ORGANISATION }}/beabee
tags: |
type=ref,event=tag
release
- id: router_meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
${{ secrets.DOCKER_ORGANISATION }}/beabee-router
tags: |
type=ref,event=tag
release
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/build-push-action@v4
with:
context: .
target: app
push: true
tags: ${{ steps.app_meta.outputs.tags }}
labels: ${{ steps.app_meta.outputs.labels }}
build-args: |
REVISION=${{ github.sha }}
- uses: docker/build-push-action@v4
with:
context: .
target: router
push: true
tags: ${{ steps.router_meta.outputs.tags }}
labels: ${{ steps.router_meta.outputs.labels }}
build-args: |
REVISION=${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: [push]
steps:
- uses: actions/checkout@v3
with:
repository: beabee-communityrm/test-deploy
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}

- run: |
git config --global user.name "Deploy bot"
git config --global user.email "<>"
echo -n ${{ needs.push.outputs.version }} > API_VERSION
./update.sh
git add API_VERSION docker-compose.yml
if ! git diff --quiet --cached; then
git commit -m "Deploy API ${{ needs.push.outputs.version }}"
git push
fi

0 comments on commit 4214823

Please sign in to comment.