trying the refine thingy #24
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
name: CD | Build-Test-Release | |
on: | |
push: | |
branches: | |
- "main" | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: "Docker Image Tag" | |
required: false | |
default: "dev" | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
# DO is a custom runner deployed on DigitalOcean, only available for workflows under the runpod-workers organization. | |
# If you would like to use this workflow, you can replace DO with ubuntu-latest or any other runner. | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Read current version | |
id: read_version | |
run: echo "::set-output name=version::$(cat version.txt)" | |
- name: Increment version | |
id: increment_version | |
run: echo "::set-output name=next_version::$(echo "${{ steps.read_version.outputs.version }}" | awk -F '.' '{print $1"."$2"."$3+1}')" | |
- name: Save incremented version | |
run: echo "${{ steps.increment_version.outputs.next_version }}" > version.txt | |
- name: Commit changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add . | |
git commit -m "Updated version via GitHub Actions" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build and push step | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ steps.increment_version.outputs.next_version }} | |