fix: fixing build context #2
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: Docker Build, Changelog, and Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push web Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./apps/web | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/web:latest | |
ghcr.io/${{ github.repository_owner }}/web:${{ github.sha }} | |
- name: Build and push api Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./apps/api | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/api:latest | |
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }} | |
generate-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog with conventional commits | |
id: changelog | |
uses: conventional-changelog/action@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
preset: conventionalcommits | |
output-file: CHANGELOG.md | |
- name: Commit changelog | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add CHANGELOG.md | |
git commit -m "chore: Update changelog" | |
git push | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [build-and-push-docker, generate-changelog] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create GitHub release | |
id: create-release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v1.0.0-${{ github.sha }} | |
release_name: Release v1.0.0-${{ github.sha }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |