mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 05:26:37 +00:00
Merge pull request #892 from tcely/patch-12
Some checks are pending
CI / info (push) Waiting to run
CI / test (3.10) (push) Waiting to run
CI / test (3.11) (push) Waiting to run
CI / test (3.12) (push) Waiting to run
CI / test (3.8) (push) Waiting to run
CI / test (3.9) (push) Waiting to run
CI / containerise (push) Blocked by required conditions
Some checks are pending
CI / info (push) Waiting to run
CI / test (3.10) (push) Waiting to run
CI / test (3.11) (push) Waiting to run
CI / test (3.12) (push) Waiting to run
CI / test (3.8) (push) Waiting to run
CI / test (3.9) (push) Waiting to run
CI / containerise (push) Blocked by required conditions
Add the `string-case` action
This commit is contained in:
commit
e4eb895b09
57
.github/actions/string-case/action.yml
vendored
Normal file
57
.github/actions/string-case/action.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
name: Change String Case
|
||||||
|
description: Make a string lowercase, uppercase, or capitalized
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
string:
|
||||||
|
description: The input string
|
||||||
|
required: true
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
lowercase:
|
||||||
|
value: ${{ steps.set.outputs.lowercase }}
|
||||||
|
description: The input string, with any uppercase characters replaced with lowercase ones
|
||||||
|
uppercase:
|
||||||
|
value: ${{ steps.set.outputs.uppercase }}
|
||||||
|
description: The input string, with any lowercase characters replaced with uppercase ones
|
||||||
|
capitalized:
|
||||||
|
value: ${{ steps.set.outputs.capitalized }}
|
||||||
|
description: The input string, with any alphabetical characters lowercase, except for the first character, which is uppercased
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Retrieve releases
|
||||||
|
id: 'set'
|
||||||
|
env:
|
||||||
|
INPUT_STRING: '${{ inputs.string }}'
|
||||||
|
shell: 'bash'
|
||||||
|
run: |
|
||||||
|
printf -- 'Manipulating string: %s\n' "${INPUT_STRING}"
|
||||||
|
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
|
||||||
|
mk_delim() { printf -- '"%s_EOF_%d_"' "$1" "${RANDOM}" ; } ;
|
||||||
|
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
|
||||||
|
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
|
||||||
|
{
|
||||||
|
|
||||||
|
var='lowercase' ;
|
||||||
|
delim="$(mk_delim "${var}")" ;
|
||||||
|
open_ml_var "${delim}" "${var}" ;
|
||||||
|
printf -- '%s\n' "${INPUT_STRING,,}" ;
|
||||||
|
close_ml_var "${delim}" "${var}" ;
|
||||||
|
|
||||||
|
var='capitalized' ;
|
||||||
|
delim="$(mk_delim "${var}")" ;
|
||||||
|
open_ml_var "${delim}" "${var}" ;
|
||||||
|
printf -- '%s\n' "${INPUT_STRING^}" ;
|
||||||
|
close_ml_var "${delim}" "${var}" ;
|
||||||
|
|
||||||
|
var='uppercase' ;
|
||||||
|
delim="$(mk_delim "${var}")" ;
|
||||||
|
open_ml_var "${delim}" "${var}" ;
|
||||||
|
printf -- '%s\n' "${INPUT_STRING^^}" ;
|
||||||
|
close_ml_var "${delim}" "${var}" ;
|
||||||
|
|
||||||
|
} >> "${GITHUB_OUTPUT}"
|
||||||
|
printf -- '%s: %s\n' 'lowercase' "${INPUT_STRING,,}"
|
||||||
|
printf -- '%s: %s\n' 'uppercase' "${INPUT_STRING^^}"
|
||||||
|
printf -- '%s: %s\n' 'capitalized' "${INPUT_STRING^}"
|
39
.github/workflows/ci.yaml
vendored
39
.github/workflows/ci.yaml
vendored
@ -23,33 +23,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
ffmpeg-releases: ${{ steps.ffmpeg.outputs.releases }}
|
ffmpeg-releases: ${{ steps.ffmpeg.outputs.releases }}
|
||||||
lowercase-variables-actor: ${{ steps.lowercase-variables.outputs.actor }}
|
lowercase-github-actor: ${{ steps.github-actor.outputs.lowercase }}
|
||||||
lowercase-variables-repository_owner: ${{ steps.lowercase-variables.outputs.repository_owner }}
|
lowercase-github-repository_owner: ${{ steps.github-repository_owner.outputs.lowercase }}
|
||||||
string-lowercase: ${{ steps.string.outputs.lowercase }}
|
|
||||||
ytdlp-latest-release: ${{ steps.yt-dlp.outputs.latest-release }}
|
ytdlp-latest-release: ${{ steps.yt-dlp.outputs.latest-release }}
|
||||||
ytdlp-releases: ${{ steps.yt-dlp.outputs.releases }}
|
ytdlp-releases: ${{ steps.yt-dlp.outputs.releases }}
|
||||||
steps:
|
steps:
|
||||||
- name: Lowercase github username for ghcr
|
- uses: actions/checkout@v4
|
||||||
id: string
|
- name: Lowercase github username
|
||||||
uses: ASzc/change-string-case-action@v6
|
id: github-actor
|
||||||
|
uses: ./.github/actions/string-case
|
||||||
with:
|
with:
|
||||||
string: ${{ github.actor }}
|
string: ${{ github.actor }}
|
||||||
- name: Lowercase GitHub variables
|
- name: Lowercase github repository owner
|
||||||
id: lowercase-variables
|
id: github-repository_owner
|
||||||
shell: bash
|
uses: ./.github/actions/string-case
|
||||||
run: |
|
with:
|
||||||
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
|
string: ${{ github.repository_owner }}
|
||||||
for var in \
|
|
||||||
actor='${{ github.actor }}' \
|
|
||||||
repository_owner='${{ github.repository_owner }}'
|
|
||||||
do
|
|
||||||
k="$( cut -d '=' -f 1 <<<"${var}" )" ;
|
|
||||||
v="${var#${k}=}" ;
|
|
||||||
set_sl_var >> "${GITHUB_OUTPUT}" \
|
|
||||||
"${k}" "${v,,}" ;
|
|
||||||
done ;
|
|
||||||
unset -v k v var ;
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Retrieve yt-dlp/FFmpeg-Builds releases with GitHub CLI
|
- name: Retrieve yt-dlp/FFmpeg-Builds releases with GitHub CLI
|
||||||
id: ffmpeg
|
id: ffmpeg
|
||||||
uses: ./.github/actions/FFmpeg
|
uses: ./.github/actions/FFmpeg
|
||||||
@ -132,10 +121,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ 'success' == needs.test.result && 'meeb' == github.repository_owner && 'pull_request' != github.event_name && 'true' || 'false' }}
|
push: ${{ 'success' == needs.test.result && 'meeb' == github.repository_owner && 'pull_request' != github.event_name && 'true' || 'false' }}
|
||||||
tags: ghcr.io/${{ needs.info.outputs.string-lowercase }}/${{ env.IMAGE_NAME }}:latest
|
tags: ghcr.io/${{ needs.info.outputs.lowercase-github-actor }}/${{ env.IMAGE_NAME }}:latest
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=registry,ref=ghcr.io/${{ needs.info.outputs.string-lowercase }}/${{ env.IMAGE_NAME }}:latest
|
type=registry,ref=ghcr.io/${{ needs.info.outputs.lowercase-github-actor }}/${{ env.IMAGE_NAME }}:latest
|
||||||
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
|
type=registry,ref=ghcr.io/${{ needs.info.outputs.lowercase-github-repository_owner }}/${{ env.IMAGE_NAME }}:latest
|
||||||
type=gha
|
type=gha
|
||||||
cache-to: |
|
cache-to: |
|
||||||
type=gha,mode=max
|
type=gha,mode=max
|
||||||
|
Loading…
Reference in New Issue
Block a user