diff --git a/.github/workflows/build-push-action.yml b/.github/workflows/build-push-action.yml index 686f600..5e76e99 100644 --- a/.github/workflows/build-push-action.yml +++ b/.github/workflows/build-push-action.yml @@ -4,25 +4,58 @@ on: push: jobs: - docker: + release: + name: Release runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + - uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + buluma/docker-ubuntu-systemd + ghcr.io/buluma/docker-ubuntu-systemd + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub - uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set short - run: echo "short=${GITHUB_REF##*/}" >> "${GITHUB_ENV}" - - name: Set tag - run: echo "tag=${short/master/latest}" >> "${GITHUB_ENV}" - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push image. + uses: docker/build-push-action@v5 with: - push: true - tags: buluma/amazonlinux:${{ env.tag }} + context: . + sbom: true + provenance: mode=max + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: | + buluma/amazonlinux:${{ env.tag }} + ghcr.io/buluma/amazonlinux:${{ env.tag }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/update_desc.yml b/.github/workflows/update_desc.yml new file mode 100644 index 0000000..b32b523 --- /dev/null +++ b/.github/workflows/update_desc.yml @@ -0,0 +1,63 @@ +--- +name: Update repo description + +on: + pull_request: + push: + paths: + - 'README.md' + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: 'false' + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: +# update docker repo description + release: + name: Update + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + + steps: + - uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + name/app + ghcr.io/username/app + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Update repo description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: buluma/amazonlinux + short-description: ${{ github.event.repository.description }} + enable-url-completion: true