-
Notifications
You must be signed in to change notification settings - Fork 111
61 lines (50 loc) · 1.99 KB
/
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
name: Release Assets
on:
workflow_dispatch:
# Workflow runs when a release is created in GitHub
release:
types: [published]
env:
DOCKER_USER: bencuk
IMAGE_NAME: kubeview
permissions:
packages: write
contents: write
jobs:
release:
name: Release image & chart
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Build the image taged with the release tag, this is the semver taged release of the image
- name: Build the Docker image
run: docker build . --file ./build/Dockerfile --build-arg version="${{ github.event.release.tag_name }}" --build-arg buildInfo="GitHub release build dated:$(date -I)" --tag ghcr.io/$GITHUB_ACTOR/$IMAGE_NAME:${{ github.event.release.tag_name }}
# Push to GHCR
- name: Push to Github registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/$GITHUB_ACTOR/$IMAGE_NAME:${{ github.event.release.tag_name }}
# Package chart as tgz file
- name: Package Helm chart
run: helm package kubeview
working-directory: ./charts
# Update the index
- name: Update chart index
run: helm repo index .
working-directory: ./charts
# Push updated index and packaged tgz back into git repo
- name: Update repo with output
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Also attach the packaged tgz to the release in GitHub
- name: Upload Helm chart to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./charts/kubeview-${{ github.event.release.tag_name }}.tgz
asset_name: kubeview-${{ github.event.release.tag_name }}.tgz
asset_content_type: application/octet-stream