forked from kubernetes-sigs/cluster-api-provider-cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update actions workflows for lsw fork
- Loading branch information
Showing
3 changed files
with
138 additions
and
4 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,42 @@ | ||
name: PR Check | ||
|
||
on: | ||
pull_request: {} | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.53.2 | ||
args: --timeout=5m | ||
|
||
build: | ||
name: Test & Build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Setup up Go 1.x | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run unit tests | ||
run: make test | ||
|
||
- name: Build | ||
run: make build |
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,92 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
tags: | ||
- v* | ||
|
||
env: | ||
REGISTRY: ghcr.io/leaseweb | ||
IMAGE_NAME: capi-cloudstack-controller | ||
TAG: build | ||
|
||
jobs: | ||
push: | ||
name: Push images | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
# This step is run when the branch is main and no tag is set | ||
- name: Sets env vars for main | ||
run: | | ||
echo "TAG=latest" >> $GITHUB_ENV | ||
if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') | ||
|
||
# This step is run when the branch is develop | ||
- name: Sets env vars for develop | ||
run: | | ||
echo "TAG=develop" >> $GITHUB_ENV | ||
if: github.ref == 'refs/heads/develop' | ||
|
||
# This step is run when there is a tag | ||
- name: Sets env vars for tag | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//') | ||
echo "TAG=${VERSION}" >> $GITHUB_ENV | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build container images | ||
run: make docker-build | ||
|
||
- name: Log into registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Push | ||
run: | | ||
docker push ${REGISTRY}/${IMAGE_NAME}:${TAG} | ||
release: | ||
name: Release | ||
runs-on: ubuntu-20.04 | ||
|
||
# Run only if previous job has succeeded | ||
needs: [push] | ||
|
||
# Create a release only for tags v* | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build release manifests | ||
run: make release-manifests | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
prerelease: false | ||
draft: true | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true | ||
name: ${{ env.TAG }} | ||
files: | | ||
out/metadata.yaml | ||
out/infrastructure-components.yaml |