diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 6ce0d2c..856f38d 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -10,72 +10,37 @@ env: REGISTRY: git.hexadual.io jobs: - server: - name: Server image + build: + name: Build & push all images runs-on: ubuntu-latest - permissions: - contents: read - packages: write steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: Log in to Gitea container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | \ + docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/rocobo/gcp-dot-server - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern={{version}} - type=sha,prefix=sha-,format=short + - name: Build & push server + run: | + docker build \ + -t ${{ env.REGISTRY }}/rocobo/gcp-dot-server:latest \ + -t ${{ env.REGISTRY }}/rocobo/gcp-dot-server:${{ github.sha }} \ + ./server + docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-server:latest + docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-server:${{ github.sha }} - - name: Build and push server image - uses: docker/build-push-action@v5 - with: - context: ./server - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Build & push egg + run: | + docker build \ + -t ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:latest \ + -t ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:${{ github.sha }} \ + ./egg + docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:latest + docker push ${{ env.REGISTRY }}/rocobo/gcp-dot-egg:${{ github.sha }} - egg: - name: Egg image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v4 - - - name: Log in to Gitea container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/rocobo/gcp-dot-egg - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern={{version}} - type=sha,prefix=sha-,format=short - - - name: Build and push egg image - uses: docker/build-push-action@v5 - with: - context: ./egg - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Logout + if: always() + run: docker logout ${{ env.REGISTRY }}