This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new deployment strategy (#255)
* 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
Showing
2 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
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
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
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 |