37b4d3c98f
SonarQube Scan / SonarQube Trigger (push) Successful in 3m56s
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-go](https://github.com/actions/setup-go) | action | major | `v6` → `v7` | --- ### Release Notes <details> <summary>actions/setup-go (actions/setup-go)</summary> ### [`v7.0.0`](https://github.com/actions/setup-go/releases/tag/v7.0.0) [Compare Source](https://github.com/actions/setup-go/compare/v7.0.0...v7.0.0) ##### What's Changed - Migrate to ESM and upgrade dependencies by [@​priyagupta108](https://github.com/priyagupta108) in [#​763](https://github.com/actions/setup-go/pull/763) - chore(deps): bump [@​actions/cache](https://github.com/actions/cache) to 6.2.0 by [@​philip-gai](https://github.com/philip-gai) in [#​771](https://github.com/actions/setup-go/pull/771) ##### New Contributors - [@​philip-gai](https://github.com/philip-gai) made their first contribution in [#​771](https://github.com/actions/setup-go/pull/771) **Full Changelog**: <https://github.com/actions/setup-go/compare/v6...v7.0.0> ### [`v7`](https://github.com/actions/setup-go/compare/v6.5.0...v7.0.0) [Compare Source](https://github.com/actions/setup-go/compare/v6.5.0...v7.0.0) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTcuOSIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ny45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: #160 Co-authored-by: Renovate-Clanker <renovate-bot@fossy.my.id> Co-committed-by: Renovate-Clanker <renovate-bot@fossy.my.id>
112 lines
3.8 KiB
YAML
112 lines
3.8 KiB
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: 'stable'
|
|
cache: false
|
|
|
|
- name: Install dependencies
|
|
run: go mod download
|
|
|
|
- name: Run go vet
|
|
run: go vet ./...
|
|
|
|
- name: Run tests
|
|
run: go test -v -p 4 ./...
|
|
|
|
|
|
build-and-push:
|
|
name: Build and Push Docker Image
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Log in to Docker Registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: git.fossy.my.id
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract version and determine release type
|
|
id: version
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
|
echo "COMMIT=${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
|
|
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
|
|
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
|
MINOR=$(echo "$VERSION" | cut -d. -f2)
|
|
PATCH=$(echo "$VERSION" | cut -d. -f3 | cut -d- -f1)
|
|
|
|
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
|
|
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
|
|
echo "PATCH=$PATCH" >> $GITHUB_OUTPUT
|
|
|
|
if echo "$VERSION" | grep -q '-'; then
|
|
PRERELEASE_TAG=$(echo "$VERSION" | cut -d- -f2 | cut -d. -f1)
|
|
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
|
|
echo "PRERELEASE_TAG=$PRERELEASE_TAG" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
else
|
|
echo "Invalid version format: $VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build and push Docker image (release)
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }}
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:release
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }}
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }}
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:latest
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.VERSION }}
|
|
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
|
|
COMMIT=${{ steps.version.outputs.COMMIT }}
|
|
if: steps.version.outputs.IS_PRERELEASE == 'false'
|
|
|
|
- name: Build and push Docker image (pre-release)
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }}
|
|
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:staging
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.VERSION }}
|
|
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
|
|
COMMIT=${{ steps.version.outputs.COMMIT }}
|
|
if: steps.version.outputs.IS_PRERELEASE == 'true' |