Skip to content

0.7.4

0.7.4 #1838

Workflow file for this run

name: Build
env:
GO_VERSION: "1.23"
ATTACHMENTS: ""
GOPATH: ${{ github.workspace }}
on:
release:
types:
- published
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: write
packages: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Chechout
uses: actions/checkout@v4
with:
path: ./src/github.com/${{ github.repository }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Install dependencies
run: |
cd ./src/github.com/${{ github.repository }}
go mod download
- name: Run tests
env:
RELEASE_VERSION: devel # version doesn't really matter for tests but still has to be set
run: |
cd ./src/github.com/${{ github.repository }}
make test
- name: Codecov
uses: codecov/codecov-action@v5
with:
file: ./src/github.com/${{ github.repository }}/cover.out
token: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
go-os: [darwin, windows, linux, freebsd]
go-arch: [amd64, 386, arm, arm64]
exclude:
# excludes 32 bit architectures for darwin builds
- go-os: darwin
go-arch: 386
- go-os: darwin
go-arch: arm
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Chechout
uses: actions/checkout@v4
with:
path: ./src/github.com/${{ github.repository }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Install dependencies
run: |
cd ./src/github.com/${{ github.repository }}
go mod download
- name: Build
env:
RELEASE_VERSION: ${{ steps.meta.outputs.version }}
OS: ${{ matrix.go-os }}
GOOS: ${{ matrix.go-os }}
ARCH: ${{ matrix.go-arch }}
GOARCH: ${{ matrix.go-arch }}
run: |
cd ./src/github.com/${{ github.repository }}
make build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: s3sync-service-${{ steps.meta.outputs.version }}-${{ matrix.go-os }}-${{ matrix.go-arch }}
path: ./src/github.com/${{ github.repository }}/bin/s3sync-service-*
docker:
runs-on: ubuntu-latest
needs: test
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
zmazay/s3sync-service
quay.io/s3sync-service/s3sync-service
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Chechout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: "quay.io"
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: ${{ secrets.GHCR_REGISTRY_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/ppc64le
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args:
RELEASE_VERSION=${{ steps.meta.outputs.version }}
publish:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
needs: build
steps:
- name: Chechout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts/
pattern: s3sync-service-*
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for artifact in $(ls artifacts/*); do ATTACHMENTS="${ATTACHMENTS} ${artifact}"; done;
gh release upload ${{ github.ref_name }} ${ATTACHMENTS}
helm-release:
name: helm-release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
needs: docker
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
steps:
- uses: actions/checkout@v4
- name: Install Helm
uses: azure/[email protected]
- name: Check if version exists
id: version-check
run: |
exists=$(aws s3api head-object --bucket ${{ vars.CHARTS_BUCKET_NAME }} --key charts/s3sync-service-${{ github.event.release.tag_name }}.tgz || true)
if [ -z "${exists}" ]; then
echo "exists=false" >> $GITHUB_OUTPUT
else
echo "exists=$exists" >> $GITHUB_OUTPUT
fi
- name: Package Helm Chart
if: steps.version-check.outputs.exists != true
run: |
cd charts
helm package s3sync-service -d ./s3sync-service/charts \
--version ${{ github.event.release.tag_name }} \
--app-version ${{ github.event.release.tag_name }}
- name: Get existing index
if: steps.version-check.outputs.exists != true
run: |
cd charts
aws s3 cp s3://${{ vars.CHARTS_BUCKET_NAME }}/index.yaml ./s3sync-service/index.yaml
- name: Generate new Helm index file
if: steps.version-check.outputs.exists != true
run: |
cd charts
helm repo index s3sync-service --url https://charts.s3sync-service.org/ --merge ./s3sync-service/index.yaml
- name: Upload the charts and index files
if: steps.version-check.outputs.exists != true
run: |
cd charts
aws s3 cp ./s3sync-service/index.html s3://${{ vars.CHARTS_BUCKET_NAME }}
aws s3 cp ./s3sync-service/index.yaml s3://${{ vars.CHARTS_BUCKET_NAME }}
aws s3 sync ./s3sync-service s3://${{ vars.CHARTS_BUCKET_NAME }} --exclude "*" --include "charts/*"