Skip to content

Commit

Permalink
Add docker build to release workflow (#186)
Browse files Browse the repository at this point in the history
* Add docker build to release workflow

Signed-off-by: Faisal Memon <fymemon@yahoo.com>

* Add package write permissions

Signed-off-by: Faisal Memon <fymemon@yahoo.com>

---------

Signed-off-by: Faisal Memon <fymemon@yahoo.com>
  • Loading branch information
faisal-memon authored Sep 11, 2024
1 parent 089a13d commit dbfe5a6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/tests/it/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
spire-server:
image: ghcr.io/spiffe/spire-server:1.7.0
Expand Down Expand Up @@ -66,4 +65,4 @@ services:
volumes:
- ./var/run/api.sock:/var/run/api.sock
- ./client/helper.conf:/opt/spire/conf/client/helper.conf
command: ["su", "client", "-c", "/opt/helper/spiffe-helper -config /opt/spire/conf/client/helper.conf"]
command: ["su", "client", "-c", "/opt/helper/spiffe-helper -config /opt/spire/conf/client/helper.conf"]
26 changes: 23 additions & 3 deletions .github/workflows/release_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
build:
name: build (linux)
runs-on: ubuntu-22.04
needs: integration-tests

steps:
- name: Checkout
Expand All @@ -53,22 +54,31 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build artifact
run: make build
- name: Build docker artifact
run: make docker-build
- name: Compress artifact
run: tar -czvf spiffe-helper-${{ github.ref_name }}.tar.gz spiffe-helper
- name: Archive artifact
uses: actions/upload-artifact@v4
with:
name: spiffe-helper
path: spiffe-helper-${{ github.ref_name }}.tar.gz
path: |
spiffe-helper-${{ github.ref_name }}.tar.gz
spiffe-helper-image.tar
release:
runs-on: ubuntu-22.04
needs: build

permissions:
contents: write
packages: write

steps:
- name: Checkout
Expand All @@ -77,9 +87,19 @@ jobs:
uses: actions/download-artifact@v4
with:
name: spiffe-helper
path: ./artifact/
path: .
- name: Log in to GHCR
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install regctl
uses: regclient/actions/regctl-installer@main
- name: Push docker image
run: ./.github/workflows/scripts/push-images.sh ${{ github.ref_name }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create the release using the version number as the title
run: gh release create "${GITHUB_REF#refs/tags/}" ./artifact/spiffe-helper-${{ github.ref_name }}.tar.gz --title "${GITHUB_REF#refs/tags/}"
run: gh release create "${GITHUB_REF#refs/tags/}" ./spiffe-helper-${{ github.ref_name }}.tar.gz --title "${GITHUB_REF#refs/tags/}"

0 comments on commit dbfe5a6

Please sign in to comment.