go-bot

Форк
0
/
docker-publish.yml 
86 строк · 3.1 Кб
1
name: Docker
2

3
# This workflow uses actions that are not certified by GitHub.
4
# They are provided by a third-party and are governed by
5
# separate terms of service, privacy policy, and support
6
# documentation.
7

8
on:
9
  workflow_dispatch:
10

11
env:
12
  # Use docker.io for Docker Hub if empty
13
  REGISTRY: docker.io
14
  # github.repository as <account>/<repo>
15
  IMAGE_NAME: ${{ secrets.IMAGE_NAME }}
16

17

18
jobs:
19
  build:
20

21
    runs-on: ubuntu-latest
22
    permissions:
23
      contents: read
24
      packages: write
25
      # This is used to complete the identity challenge
26
      # with sigstore/fulcio when running outside of PRs.
27
      id-token: write
28

29
    steps:
30
      - name: Checkout repository
31
        uses: actions/checkout@v2
32

33
      # Install the cosign tool except on PR
34
      # https://github.com/sigstore/cosign-installer
35
      - name: Install cosign
36
        if: github.event_name != 'pull_request'
37
        uses: sigstore/cosign-installer@1e95c1de343b5b0c23352d6417ee3e48d5bcd422
38
        with:
39
          cosign-release: 'v1.4.0'
40

41

42
      # Workaround: https://github.com/docker/build-push-action/issues/461
43
      - name: Setup Docker buildx
44
        uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
45

46
      # Login against a Docker registry except on PR
47
      # https://github.com/docker/login-action
48
      - name: Log into registry ${{ env.REGISTRY }}
49
        if: github.event_name != 'pull_request'
50
        uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
51
        with:
52
          registry: ${{ env.REGISTRY }}
53
          username: ${{ secrets.DOCKER_HUB_USERNAME }}
54
          password: ${{ secrets.DOCKER_HUB_TOKEN }}
55

56
      # Extract metadata (tags, labels) for Docker
57
      # https://github.com/docker/metadata-action
58
      - name: Extract Docker metadata
59
        id: meta
60
        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
61
        with:
62
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
63

64
      # Build and push Docker image with Buildx (don't push on PR)
65
      # https://github.com/docker/build-push-action
66
      - name: Build and push Docker image
67
        id: build-and-push
68
        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
69
        with:
70
          context: .
71
          push: ${{ github.event_name != 'pull_request' }}
72
          tags: ${{ steps.meta.outputs.tags }}
73
          labels: ${{ steps.meta.outputs.labels }}
74

75
      # Sign the resulting Docker image digest except on PRs.
76
      # This will only write to the public Rekor transparency log when the Docker
77
      # repository is public to avoid leaking data.  If you would like to publish
78
      # transparency data even for private images, pass --force to cosign below.
79
      # https://github.com/sigstore/cosign
80
      - name: Sign the published Docker image
81
        if: ${{ github.event_name != 'pull_request' }}
82
        env:
83
          COSIGN_EXPERIMENTAL: "true"
84
        # This step uses the identity token to provision an ephemeral certificate
85
        # against the sigstore community Fulcio instance.
86
        run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
87

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.