aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/release.yml
blob: 163f60145bb13b4f4274ab0fa01e9336d197f4a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Release (PyPi, DockerHub)
on:
  release:
    types: [published]

jobs:
  pypi_release:
    name: Release on PyPi
    runs-on: ubuntu-latest
    if: github.repository == 'crocs-muni/sec-certs'
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.8"
      - name: Install build dependencies
        run: python -m pip install build
      - name: Build distributions
        shell: bash -l {0}
        run: python -m build
      - name: Publish package to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: ${{ secrets.PYPI_USERNAME }}
          password: ${{ secrets.PYPI_PASSWORD }}
  docker_release:
    name: Release on DockerHub
    runs-on: ubuntu-latest
    if: github.repository == 'crocs-muni/sec-certs'
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Build
        uses: docker/setup-buildx-action@v1
      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_PASSWORD }}
      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
        with:
          images: seccerts/sec-certs
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          file: Dockerfile
          push: true
          tags: ${{ steps.meta.outputs.tags }}