This repository has been archived by the owner on May 21, 2024. It is now read-only.
Merge pull request #17 from photonsquid/BSoDium-patch-1 #38
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 | |
on: | |
push: | |
branches: | |
- main # Push to main branch | |
- ci-cd/* | |
jobs: | |
publish: | |
runs-on: "ubuntu-latest" | |
if: "contains(github.event.head_commit.message, 'trigger-cd') || contains(github.event.head_commit.message, 'Merge & deploy')" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update repos list | |
run: sudo apt-get update | |
- name: Install maven | |
run: sudo apt-get -y install --no-install-recommends maven | |
- name: Generate war | |
run: | | |
mvn war:war | |
- name: Build images | |
run: | | |
docker build -t ghcr.io/photonsquid/houseportal-backend . | |
- name: Login to GitHub Packages | |
env: | |
TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
run: | | |
echo ${{ env.TOKEN }} | docker login ghcr.io -u photonsquid --password-stdin | |
- name: Push to GitHub Packages | |
id: push-to-gh-packages | |
run: | | |
tag=$(git rev-parse --short HEAD) | |
docker tag ghcr.io/photonsquid/houseportal-backend ghcr.io/photonsquid/houseportal-backend:$tag | |
docker push ghcr.io/photonsquid/houseportal-backend:$tag | |
docker push ghcr.io/photonsquid/houseportal-backend | |
echo ::set-output name=tag::$tag | |
- name: Logout | |
run: | | |
docker logout | |
- name: Create commit comment | |
uses: peter-evans/commit-comment@v2 | |
with: | |
body: | | |
## Summary | |
✅ Commit successfully deployed to GitHub packages. | |
🔗 Commit reference: `${{ github.sha }}` | |
📦 Deployed image tag: `${{ steps.push-to-gh-packages.outputs.tag }}` | |
_This message was automatically generated by an action workflow._ | |