Skip to content

testing release workflow #1

testing release workflow

testing release workflow #1

name: Build and Push Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
create_release:
runs-on: ubuntu-latest-4-cores-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Env
run: |
VERSION=$(echo "${GITHUB_REF#refs/*/}" | sed 's/^v//')
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true.
- name: Build release artifacts for arm64
run: |
docker buildx build --platform linux/arm64/v8 --output type=local,dest=docker_output/ -t peridiod:${RELEASE_TAG} -f support/Containerfile-release.arm64 .
- name: Create GitHub Release
id: create_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $RELEASE_TAG \
--title $RELEASE_TAG \
--notes "$(awk "/## $RELEASE_TAG/{flag=1;next}/##/{flag=0}flag" CHANGELOG.md)"
- name: Upload Release Asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./docker_output/arm64/peridiod-${RELEASE_VERSION}.tar.gz ./docker_output/peridiod-${RELEASE_VERSION}-arm64.tar.gz
gh release upload $RELEASE_TAG ./docker_output/peridiod-${RELEASE_VERSION}-arm64.tar.gz --clobber
- name: Load docker hub credentials
id: op-load-docker-hub-credentials
uses: 1password/load-secrets-action@v1
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
DOCKER_HUB_USERNAME: op://ci-cd/docker-hub-machine/username
DOCKER_HUB_PASSWORD: op://ci-cd/docker-hub-machine/password
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ steps.op-load-docker-hub-credentials.outputs.DOCKER_HUB_USERNAME }}
password: ${{ steps.op-load-docker-hub-credentials.outputs.DOCKER_HUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
platforms: linux/arm64/v8
push: true
tags: |
peridio/peridiod:$RELEASE_VERSION
peridio/peridiod:latest
- name: Image digest
id: image_digest
uses: docker/metadata-action@v5
with:
images: peridio/peridiod
- name: Output image digest
run: echo ${{ steps.image_digest.outputs.digest }}