-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
204 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: DEV Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repository: | ||
description: 'Repository name with owner.' | ||
required: true | ||
default: 'jodevsa/wireguard-operator' | ||
type: string | ||
branch: | ||
description: 'The branch, tag or SHA to checkout.' | ||
required: true | ||
default: 'main' | ||
type: string | ||
platforms: | ||
description: 'Docker image platforms' | ||
required: true | ||
default: 'linux/amd64, linux/arm64' | ||
type: string | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-manager: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.branch }} | ||
submodules: true | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
tags: | | ||
type=sha,format=long,prefix=development- | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/manager | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: ./images/manager/Dockerfile | ||
context: ./ | ||
push: true | ||
platforms: ${{ inputs.platforms }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
outputs: | ||
image: ${{ steps.meta.outputs.tags }} | ||
|
||
build-agent: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.branch }} | ||
submodules: true | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
tags: | | ||
type=sha,format=long,prefix=development- | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/agent | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: ./images/agent/Dockerfile | ||
context: ./ | ||
push: true | ||
platforms: ${{ inputs.platforms }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
outputs: | ||
image: ${{ steps.meta.outputs.tags }} | ||
|
||
save-release: | ||
needs: [build-agent, build-manager] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.branch }} | ||
submodules: true | ||
|
||
- name: prepare new release | ||
env: | ||
MANAGER_IMAGE: ${{ needs.build-manager.outputs.image }} | ||
AGENT_IMAGE: ${{ needs.build-agent.outputs.image }} | ||
run : | | ||
make generate-release-file AGENT_IMAGE="$AGENT_IMAGE" MANAGER_IMAGE="$MANAGER_IMAGE" | ||
mv ./release.yaml /tmp/release.yaml | ||
- name: upload release | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: manual-release-dev.yaml | ||
path: /tmp/manual-release-dev.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters