diff --git a/.github/workflows/build-image-master.yml b/.github/workflows/build-image-master.yml new file mode 100644 index 0000000..dea90b3 --- /dev/null +++ b/.github/workflows/build-image-master.yml @@ -0,0 +1,36 @@ +--- +name: Build and push Docker image tagged master + +on: + push: + branches: + - main + +permissions: + contents: read # principle of least privilege + +jobs: + build: + name: Build and push Docker image tagged master + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Docker Buildx for multi-platform builds + uses: docker/setup-buildx-action@v3 + with: + platforms: ${{ vars.PLATFORMS }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + platforms: ${{ vars.PLATFORMS }} + push: true + sbom: true + tags: >- + ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ vars.IMAGE_NAME }}: + master diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-image-semver.yml similarity index 67% rename from .github/workflows/build-docker-images.yml rename to .github/workflows/build-image-semver.yml index d0d5212..cda8557 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-image-semver.yml @@ -1,5 +1,5 @@ --- -name: Build and push Docker image +name: Build and push semver-tagged Docker image on: push: @@ -11,19 +11,15 @@ permissions: jobs: build: - name: Build and push Docker image + name: Build and push semver-tagged Docker image runs-on: ubuntu-22.04 - env: - PLATFORMS: linux/amd64,linux/arm64/v8 - IMAGE_NAME: lightningstream - IMAGE_TAGS: type=semver,pattern={{version}} steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Buildx for multi-platform builds uses: docker/setup-buildx-action@v3 with: - platforms: ${{ env.PLATFORMS }} + platforms: ${{ vars.PLATFORMS }} - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -33,12 +29,12 @@ jobs: uses: docker/metadata-action@v5 with: images: >- - ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }} - tags: ${{ env.IMAGE_TAGS }} + ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ vars.IMAGE_NAME }} + tags: type=semver,pattern={{version}} - name: Build and push Docker image uses: docker/build-push-action@v6 with: - platforms: ${{ env.PLATFORMS }} + platforms: ${{ vars.PLATFORMS }} push: true sbom: true tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}