generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 11
82 lines (70 loc) · 2.45 KB
/
make-github-and-docker-release.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Create docker release and github release
on:
workflow_dispatch:
pull_request:
branches: [master]
types: [closed]
paths: ["nca/VERSION.txt"]
permissions:
contents: read
jobs:
push_to_registry:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
name: Push a Docker image to the Docker Hub and create a github release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Setup NCA environment
uses: ./.github/actions/setup-nca-env
- name: Set the version number
run: |
export VERSION=$(cat nca/VERSION.txt)
echo "version=$VERSION" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@44ea916f6c540f9302d50c2b1e5a8dc071f15cdf
with:
context: .
push: true
tags: ghcr.io/ibm/nca:${{ env.version }}
- name: Build and push ubi-based Docker image
uses: docker/build-push-action@44ea916f6c540f9302d50c2b1e5a8dc071f15cdf
with:
context: .
file: Dockerfile.ubi
push: true
tags: ghcr.io/ibm/nca:${{ env.version }}-ubi
- name: Create and push a new git tag
run: |
git config user.name ${{ github.actor }}
git tag -a v${{ env.version }} -m "Version ${{ env.version }}"
git push origin v${{ env.version }}
- name: Create a github release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
release_name: Release v${{ env.version }}
body: |
Changes in this Release:
draft: false
prerelease: false
- name: Build package
run: |
pip install build==0.10.0
python -m build
- name: Push version to PyPi
uses: pypa/gh-action-pypi-publish@0bf742be3ebe032c25dd15117957dc15d0cfc38d
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}