-
Notifications
You must be signed in to change notification settings - Fork 51
109 lines (93 loc) · 3.6 KB
/
publish.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Creating release & publishing container
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Golang
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: '1.23'
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: lfedge/edge-home-orchestration-go
tags: |
type=semver,pattern={{version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Copy Dockerfile
run: |
make distclean
cp configs/defdockerfiles/ubuntu_multistage Dockerfile
- name: Build and push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
with:
context: .
build-args: TARGETVERSION=v${{ steps.meta.outputs.version }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Create Release
create-release:
permissions:
contents: write # for marvinpinto/action-automatic-releases to generate pre-release
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
with:
egress-policy: audit
- uses: marvinpinto/action-automatic-releases@d68defdd11f9dcc7f52f35c1b7c236ee7513bcc1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "Edge-Orchestration ${{ github.ref_name }}"
# Generate Hashes
generate_hashes:
needs: [create-release]
runs-on: ubuntu-latest
name: Generate Hashes
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- name: Download Source Code Assets
run: |
VERSION=${{ github.ref_name }}
wget https://github.com/${{ github.repository }}/archive/refs/tags/${VERSION}.tar.gz
wget https://github.com/${{ github.repository }}/archive/refs/tags/${VERSION}.zip
mv ${VERSION}.tar.gz edge-home-orchestration-go-${VERSION:1}.tar.gz
mv ${VERSION}.zip edge-home-orchestration-go-${VERSION:1}.zip
- name: Generate hashes
id: hash
run: |
VERSION=${{ github.ref_name }}
echo "hashes=$(sha256sum edge-home-orchestration-go-${VERSION:1}.tar.gz edge-home-orchestration-go-${VERSION:1}.zip | base64 -w0)" >> "$GITHUB_OUTPUT"
provenance:
needs: [generate_hashes, create-release]
name: Generate Provenance
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: "${{ needs.generate_hashes.outputs.hashes }}"
upload-assets: true # Optional: Upload to a new release