Skip to content

Commit 6e26131

Browse files
authored
Update publish action (#30)
1 parent 6f0ca1b commit 6e26131

File tree

2 files changed

+82
-13
lines changed

2 files changed

+82
-13
lines changed

.github/workflows/publish-helm-charts.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/publish.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: publish
2+
on:
3+
release:
4+
types: [published]
5+
env:
6+
NAME: "azdo-proxy"
7+
jobs:
8+
helm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Clone repo
12+
uses: actions/checkout@v2
13+
- name: Get GitHub Tag
14+
id: get_tag
15+
run: |
16+
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
17+
- name: Publish Helm charts
18+
uses: stefanprodan/helm-gh-pages@master
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
chart_version: ${{ steps.get_tag.outputs.tag }}
22+
app_version: ${{ steps.get_tag.outputs.tag }}
23+
image:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Clone repo
27+
uses: actions/checkout@v2
28+
- name: Prepare
29+
id: prep
30+
run: |
31+
VERSION=sha-${GITHUB_SHA::8}
32+
if [[ $GITHUB_REF == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF/refs\/tags\//}
34+
fi
35+
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
36+
echo ::set-output name=VERSION::${VERSION}
37+
- name: Get GitHub Tag
38+
id: get_tag
39+
run: |
40+
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
41+
- name: Cache container layers
42+
uses: actions/cache@v2.1.4
43+
with:
44+
path: /tmp/.buildx-cache
45+
key: ${{ runner.os }}-buildx-${{ github.sha }}
46+
restore-keys: |
47+
${{ runner.os }}-buildx-
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v1
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v1
52+
- name: Login to GitHub Container Registry
53+
uses: docker/login-action@v1
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.repository_owner }}
57+
password: ${{ secrets.CR_PAT }}
58+
- name: Build and push container (multi arch)
59+
uses: docker/build-push-action@v2
60+
with:
61+
push: true
62+
context: .
63+
file: ./Dockerfile
64+
platforms: linux/amd64,linux/arm/v7,linux/arm64
65+
cache-from: type=local,src=/tmp/.buildx-cache
66+
cache-to: type=local,dest=/tmp/.buildx-cache
67+
tags: ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
68+
build-args: |
69+
VERSION=${{ steps.prep.outputs.VERSION }}
70+
REVISION=${{ github.sha }}
71+
CREATED=${{ steps.prep.outputs.BUILD_DATE }}
72+
labels: |
73+
org.opencontainers.image.title=${{ github.event.repository.name }}
74+
org.opencontainers.image.description=${{ github.event.repository.description }}
75+
org.opencontainers.image.url=${{ github.event.repository.html_url }}
76+
org.opencontainers.image.revision=${{ github.sha }}
77+
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
78+
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
79+
- name: Check images
80+
run: |
81+
docker buildx imagetools inspect ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
82+
docker pull ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}

0 commit comments

Comments
 (0)