Skip to content

Release for Push on next #16

Release for Push on next

Release for Push on next #16

Workflow file for this run

name: Release
run-name: Release for Push on ${{ github.ref_name }} #${{ github.run_number }}
on:
push:
branches:
- main
- next
paths-ignore:
- 'CHANGELOG.md'
env:
ACT: ""
NEW_VERSION: ""
permissions:
contents: read
jobs:
github-release:
name: GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Release
id: semantic_release
if: ${{ !env.ACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
OUTPUT=$(npx semantic-release)
echo "$OUTPUT"
NEW_VERSION=$(echo "$OUTPUT" | grep "Published release" | cut -d" " -f9)
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Release (DRY RUN)
id: semantic_release_dry_run
if: ${{ env.ACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DRY_RUN_OUTPUT=$(npx semantic-release --dry-run)
echo "$DRY_RUN_OUTPUT"
NEW_VERSION=$(echo "$DRY_RUN_OUTPUT" | grep "Published release" | cut -d" " -f9)
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
outputs:
new_version: ${{ steps.semantic_release.outputs.new_version }}
new_version_dry_run: ${{ steps.semantic_release_dry_run.outputs.new_version }}
dockerhub-release:
name: Push Image to DockerHub
needs: github-release
if: needs.github-release.outputs.new_version != '' || needs.github-release.outputs.new_version_dry_run != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@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: Create Docker Metadata (wine) (Tags)
if: ${{ !env.ACT }}
id: meta
uses: docker/metadata-action@v5
with:
images: |
johnnyknighten/ark-sa-server
tags: |
${{ (github.ref == 'refs/heads/main') && 'type=raw,value=latest-wine' || '' }}
type=semver,pattern={{version}},suffix=-wine,onlatest=true,value=${{ needs.github-release.outputs.new_version }}
type=semver,pattern={{version}},suffix,value=${{ needs.github-release.outputs.new_version }}
- name: Create Docker Metadata (wine) (Tags) (DRY RUN)
if: ${{ env.ACT }}
id: meta-dry-run
uses: docker/metadata-action@v5
with:
images: |
johnnyknighten/ark-sa-server
tags: |
${{ (github.ref == 'refs/heads/main') && 'type=raw,value=latest-wine' || '' }}
type=semver,pattern={{version}},suffix=-wine,onlatest=true,value=${{ needs.github-release.outputs.new_version_dry_run }}
type=semver,pattern={{version}},suffix,value=${{ needs.github-release.outputs.new_version_dry_run }}
- name: Push Image to DockerHub
if: ${{ !env.ACT }}
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
- name: Push Image to Docker Hub (DRY RUN)
if: ${{ env.ACT }}
run: |
echo "DRY RUN - Skipping Docker Build and Push"
echo "The Following Images Would Have Been Pushed:"
echo "${{ steps.meta-dry-run.outputs.tags }}"
- name: Update DockerHub Description
if: ${{ !env.ACT && github.ref == 'refs/heads/main' }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: johnnyknighten/ark-sa-server
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
- name: Update DockerHub Description (DRY RUN)
if: ${{ env.ACT && github.ref == 'refs/heads/main' }}
run: |
echo "DRY RUN - Pushing Dockerhub Description Update"