Refactor initial migration and update schema #141
This file contains hidden or 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: CI | |
| env: | |
| IMAGE_NAME: octockup | |
| CONTEXT_PATH: Sources | |
| SOURCES_PATH: Octockup.Server | |
| on: | |
| push: | |
| paths: | |
| - "Sources/**" | |
| - ".github/workflows/**" | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Version: ${{ steps.gitversion.outputs.SemVer }} | |
| CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: check repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: "true" | |
| fetch-depth: 0 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v3.1.11 | |
| with: | |
| versionSpec: 5.x | |
| - name: Determine Version | |
| uses: gittools/actions/gitversion/execute@v3.1.11 | |
| id: gitversion # step id used as reference for output values | |
| - name: Display GitVersion outputs | |
| run: | | |
| echo "Version: ${{ steps.gitversion.outputs.SemVer }}" | |
| echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" | |
| - name: login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{secrets.DOCKERHUB_USERNAME}} | |
| password: ${{secrets.DOCKERHUB_TOKEN}} | |
| - name: Build and push docker image to Docker Hub | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ env.CONTEXT_PATH }} | |
| push: true | |
| tags: | | |
| bvdcode/${{ env.IMAGE_NAME }}:latest | |
| bvdcode/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.semVer }} | |
| file: ${{ env.CONTEXT_PATH }}/${{ env.SOURCES_PATH }}/Dockerfile | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push docker image to GitHub Container Registry | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ env.CONTEXT_PATH }} | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.semVer }} | |
| ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | |
| file: ${{ env.CONTEXT_PATH }}/${{ env.SOURCES_PATH }}/Dockerfile | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' # only run job if on the master branch | |
| steps: | |
| - name: Create Release | |
| if: needs.build.outputs.CommitsSinceVersionSource > 0 | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ needs.build.outputs.Version }} | |
| name: Release ${{ needs.build.outputs.Version }} | |
| artifacts: "nupkg/*" | |
| token: ${{ secrets.GITHUB_TOKEN }} |