github release fix
This commit is contained in:
parent
be054323a6
commit
4254f47ea5
3 changed files with 32 additions and 81 deletions
107
.github/workflows/ci.yml
vendored
107
.github/workflows/ci.yml
vendored
|
|
@ -112,11 +112,11 @@ jobs:
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
cache-to: type=gha,scope=build-branch,mode=max
|
cache-to: type=gha,scope=build-branch,mode=max
|
||||||
|
|
||||||
build-main:
|
release:
|
||||||
name: Build (Main)
|
name: Release (Multi-arch)
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
@ -126,73 +126,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Needed for git describe
|
fetch-depth: 0 # Needed for git describe
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate version info
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
VERSION=$(git describe --tags --always --dirty=-modified | sed 's/^v//')
|
|
||||||
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
|
||||||
SHORT_SHA=${GITHUB_SHA::7}
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
|
|
||||||
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
||||||
echo "Building version $VERSION at $TIMESTAMP"
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
provenance: false
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
|
||||||
BUILDKIT_INLINE_CACHE=1
|
|
||||||
tags: |
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ steps.version.outputs.short_sha }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ steps.version.outputs.timestamp }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
||||||
cache-from: |
|
|
||||||
type=gha,scope=build-main
|
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
cache-to: |
|
|
||||||
type=gha,scope=build-main,mode=max
|
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
run: |
|
|
||||||
echo "### Built and pushed with tags:" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "- \`latest\` (for production)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "- \`main\` (for Watchtower tracking)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "- \`${{ steps.version.outputs.version }}\` (git describe)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "- \`main-${{ steps.version.outputs.short_sha }}\` (commit)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "- \`main-${{ steps.version.outputs.timestamp }}\` (timestamp)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release (Multi-arch)
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
|
@ -206,14 +139,26 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Generate version info
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
TAG=${GITHUB_REF#refs/tags/}
|
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||||
VERSION=${TAG#v}
|
# Tag push - extract version from tag
|
||||||
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
TAG=${GITHUB_REF#refs/tags/}
|
||||||
|
VERSION=${TAG#v}
|
||||||
|
echo "is_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
# Main branch push - use git describe
|
||||||
|
VERSION=$(git describe --tags --always --dirty=-modified | sed 's/^v//')
|
||||||
|
echo "is_tag=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
||||||
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "Releasing version: $VERSION"
|
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
|
||||||
|
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
||||||
|
echo "Building version $VERSION"
|
||||||
|
|
||||||
- name: Build and push (multi-arch)
|
- name: Build and push (multi-arch)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
|
|
@ -226,11 +171,12 @@ jobs:
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
BUILDKIT_INLINE_CACHE=1
|
BUILDKIT_INLINE_CACHE=1
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.timestamp }}
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=gha,scope=build-main
|
|
||||||
type=gha,scope=release
|
type=gha,scope=release
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
@ -242,3 +188,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "### Released version: ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
echo "### Released version: ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Multi-architecture build (amd64, arm64)" >> $GITHUB_STEP_SUMMARY
|
echo "Multi-architecture build (amd64, arm64)" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "Tags pushed:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`latest\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`sha-${{ steps.version.outputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`${{ steps.version.outputs.timestamp }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ The Towerops agent enables customers to deploy SNMP polling infrastructure on th
|
||||||
Pull the latest image from Docker Hub:
|
Pull the latest image from Docker Hub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull gmcintire/towerops-agent:latest
|
docker pull ghcr.io/towerops-app/towerops-agent:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Docker Compose
|
### Using Docker Compose
|
||||||
|
|
@ -36,7 +36,7 @@ version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
towerops-agent:
|
towerops-agent:
|
||||||
image: gmcintire/towerops-agent:latest
|
image: ghcr.io/towerops-app/towerops-agent:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- TOWEROPS_API_URL=https://towerops.net
|
- TOWEROPS_API_URL=https://towerops.net
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
towerops-agent:
|
towerops-agent:
|
||||||
image: registry.gitlab.com/towerops/towerops-agent:latest
|
image: ghcr.io/towerops-app/towerops-agent:latest
|
||||||
container_name: towerops-agent
|
container_name: towerops-agent
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue