Skip to content

Update Workflows

Update Workflows #1

Workflow file for this run

name: Reusable binary publish workflow
permissions:
contents: write
on:
workflow_call:
inputs:
<<<<<<< HEAD

Check failure on line 9 in .github/workflows/publish-base.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-base.yml

Invalid workflow file

You have an error in your yaml syntax on line 9
=======
# The tag that we are publishing to
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
tag:
required: false
type: string
default: ""
<<<<<<< HEAD
description: The version tag to publish
github-artifact-name:
required: true
type: string
description: The github artifact to download the artifact from.
# The path after the target-path to publish the artifact to
# {artifact | {target-path}/{target-artifact-path}
target-artifact-path:
required: false
type: string
default: ""
description: |
The path that goes after target-path to specify a subdirectory
to publish to. Final path: {target-path}/{target-artifact-path}
# The path within the github artifact that the artifact is located at.
source-path:
required: false
type: string
default: ""
description: |
The path within the github artifact where the artifact is located at
secrets:
# The target path within the host share to save files to
target-path:
required: true
description: |
The path within the host machine where the data should be published
to.
ssh-key:
required: true
description: The ssh private key that is used to publish to the host.
host:
required: true
description: The host that has sshd running to publish to.
port:
required: true
description: The port the host is running sshd on.
user:
required: true
description: THe username to log in to the server as.
jobs:
publish:
runs-on: ubuntu-latest
steps:
# If this is somehow not run from a tag, fail. This is a remainder from
# when the build side and publish side were done in one workflow.
- name: Check tag status
if: |
startsWith(github.ref, 'refs/tags/')
&& ! endsWith(github.ref, inputs.tag)
=======
# The name of what we are building
artifact:
required: true
type: string
# The name that will be used to same build artifacts to share
# between jobs
github-artifact-name:
required: true
type: string
# The root path to publish package to. If left blank, artifact
# is used.
artifact-target-name:
required: false
type: string
default: ""
# The target path that goes before the artifact-target-name
# {artifact | artifact-target-name}/{target-path}
target-path:
required: false
type: string
default: ""
# The folder where the stuff to be published is located
source:
required: true
type: string
secrets:
ssh-key:
required: true
host:
required: true
port:
required: true
user:
required: true
jobs:
publish:
runs-on: macos-latest
steps:
- name: Check tag status
if: ${{ startsWith(github.ref, 'refs/tags/') && ! endsWith(github.ref, input.tag) }}
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
uses: actions/github-script@v3
with:
script: |
core.setFailed("Provided tag does not match github ref tag")
<<<<<<< HEAD
# Download the requested github artifact
- name: Download artifacts
id: download
uses: actions/download-artifact@v4
with:
name: ${{ inputs.github-artifact-name }}
# Get the path to where the artifact is at. This is the path to the
# downloaded artifact that is relative to the github workspace with the
# source-path parameter tacked on the end.
- name: Get Source Path
shell: bash
id: get-source-path
run: |
echo "path=$( \
realpath -s --relative-to="${{ github.workspace }}" \
"${{ steps.download.outputs.download-path }}/${{ inputs.source-path }}" \
)" >> $GITHUB_OUTPUT
# Publish to the host
=======
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ input.github-artifact-name }}
- name: Get Target
id: get-target
run: |
if [ -z ${{ input.artifact-target-name }} ]; then
echo "PUB_TARGET=${{ input.artifact }}" >> $GITHUB_OUTPUT;
else
echo "PUB_TARGET=${{ input.artifact-target-name }}" >> $GITHUB_OUTPUT;
fi
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
- name: Publish Release
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.ssh-key }}
ARGS: "-vzrli"
<<<<<<< HEAD
SOURCE: ${{ steps.get-source-path.outputs.path }}
REMOTE_HOST: ${{ secrets.host }}
REMOTE_USER: ${{ secrets.user }}
REMOTE_PORT: ${{ secrets.port }}
TARGET: ${{ secrets.target-path }}/${{ inputs.target-artifact-path }}
# Create the release draft on GitHub.
- name: Create Release Draft
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, inputs.tag) }}
uses: ncipollo/release-action@v1
with:
# artifacts: "artifacts-${{ github.sha }}/*"
# artifactErrorsFailBuild: true
=======
SOURCE: ${{ input.source }}
REMOTE_HOST: ${{ secrets.host }}
REMOTE_USER: ${{ secrets.user }}
REMOTE_PORT: ${{ secrets.port }}
TARGET: ${{ steps.get-target.outputs.PUB_TARGET }}/${{ inputs.target-path }}
- name: Create Release Draft
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, input.tag) }}
uses: ncipollo/release-action@v1
with:
artifacts: ${{ input.source }}/*
artifactErrorsFailBuild: true
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
draft: true
generateReleaseNotes: true
tag: ${{ inputs.tag }}
prerelease: ${{ contains(inputs.tag, '-beta') || contains(inputs.tag, '-alpha') || contains(inputs.tag, '-rc') }}