chore: v0.0.7 #52
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: Build new tag | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| #needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build the Docker image | |
| run: docker build . --tag thechristophe/openapi-typebox:${{ github.ref_name }} --target prod | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push the latest Docker image | |
| uses: docker/build-push-action@v6 | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| with: | |
| push: true | |
| tags: ghcr.io/thechristophe/openapi-typebox:latest | |
| - name: Push the Docker image with the release tag | |
| uses: docker/build-push-action@v6 | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| with: | |
| push: true | |
| tags: ghcr.io/thechristophe/openapi-typebox:${{ github.ref_name }} | |
| - name: Clone github action | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: thechristophe/openapi-typebox-action | |
| ref: 'main' | |
| token: ${{ secrets.ACTION_REPO_PUSH_TOKEN }} | |
| path: action-repo | |
| - name: Update github action | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| run: | | |
| pushd action-repo | |
| git config user.name "GitHub Action" | |
| git config user.email "<>" | |
| sed -i -E "s;thechristophe/openapi-typebox:(dev|v.+)$;thechristophe/openapi-typebox:${{ github.ref_name }};g" action.yml | |
| git add action.yml | |
| git commit -m "${{ github.ref_name }}" | |
| git tag "${{ github.ref_name }}" | |
| git push | |
| git push origin "${{ github.ref_name }}" | |
| popd | |
| - name: Push the Docker image with dev tag | |
| uses: docker/build-push-action@v6 | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| with: | |
| push: true | |
| tags: ghcr.io/thechristophe/openapi-typebox:dev |