mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 13:36:35 +00:00
Move more steps into the info
job
This commit is contained in:
parent
5e6c9f144a
commit
cacf306b09
79
.github/workflows/ci.yaml
vendored
79
.github/workflows/ci.yaml
vendored
@ -13,8 +13,45 @@ jobs:
|
||||
info:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
ffmpeg-releases: ${{ steps.ffmpeg.outputs.releases }}
|
||||
string-lowercase: ${{ steps.string.outputs.lowercase }}
|
||||
ytdlp_tag: ${{ steps.set.outputs.ytdlp_tag }}
|
||||
steps:
|
||||
- name: Lowercase github username for ghcr
|
||||
id: string
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
with:
|
||||
string: ${{ github.actor }}
|
||||
- name: Retrieve yt-dlp/FFmpeg-Builds releases with GitHub CLI
|
||||
id: ffmpeg
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_API_GQL_ASSETS: 25
|
||||
GH_API_GQL_RELEASES: 35
|
||||
GH_API_GQL_OWNER: yt-dlp
|
||||
GH_API_GQL_REPO: FFmpeg-Builds
|
||||
run: |
|
||||
gql_query='query($repo: String!, $owner: String!, $releases: Int!, $assets: Int!) { repository(owner: $owner, name: $repo) { releases(first: $releases, orderBy: { field: CREATED_AT, direction: DESC}) { nodes { tagName, isDraft, isPrerelease, isLatest, tag { name, target { oid, commitUrl } }, releaseAssets(first: $assets) { totalCount, nodes { name, size, downloadUrl } } } } } }' ;
|
||||
gql_jq='[ .data.repository.releases.nodes[] | select((.isLatest or .isDraft or .isPrerelease) | not) | { "tag": .tag.name, "commit": .tag.target.oid, "date": .tag.name[1+(.tag.name|index("-")):], "assets": { "limit": '"${GH_API_GQL_ASSETS}"', "totalCount": .releaseAssets.totalCount }, "files": .releaseAssets.nodes, "versions": [ .releaseAssets.nodes[].name | select(contains("-linux64-"))[1+index("-"):index("-linux64-")] ] } ]' ;
|
||||
{
|
||||
var='releases' ;
|
||||
delim='"'"${var}"'_EOF"' ;
|
||||
printf -- '%s<<%s\n' "${var}" "${delim}" ;
|
||||
gh api graphql --cache 12h \
|
||||
-F assets="${GH_API_GQL_ASSETS}" \
|
||||
-F owner="${GH_API_GQL_OWNER}" \
|
||||
-F repo="${GH_API_GQL_REPO}" \
|
||||
-F releases="${GH_API_GQL_RELEASES}" \
|
||||
-f query="${gql_query}" --jq "${gql_jq}" ;
|
||||
printf -- '%s\n' "${delim}" ;
|
||||
unset -v delim jq_arg var ;
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
gh api graphql --cache 12h \
|
||||
-F assets="${GH_API_GQL_ASSETS}" \
|
||||
-F owner="${GH_API_GQL_OWNER}" \
|
||||
-F repo="${GH_API_GQL_REPO}" \
|
||||
-F releases="${GH_API_GQL_RELEASES}" \
|
||||
-f query="${gql_query}" --jq "${gql_jq}" | jq '.[]' -- ;
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set outputs
|
||||
id: set
|
||||
@ -53,40 +90,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- name: Retrieve yt-dlp/FFmpeg-Builds releases with GitHub CLI
|
||||
id: ffmpeg
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_API_GQL_ASSETS: 25
|
||||
GH_API_GQL_RELEASES: 35
|
||||
GH_API_GQL_OWNER: yt-dlp
|
||||
GH_API_GQL_REPO: FFmpeg-Builds
|
||||
run: |
|
||||
gql_query='query($repo: String!, $owner: String!, $releases: Int!, $assets: Int!) { repository(owner: $owner, name: $repo) { releases(first: $releases, orderBy: { field: CREATED_AT, direction: DESC}) { nodes { tagName, isDraft, isPrerelease, isLatest, tag { name, target { oid, commitUrl } }, releaseAssets(first: $assets) { totalCount, nodes { name, size, downloadUrl } } } } } }' ;
|
||||
gql_jq='[ .data.repository.releases.nodes[] | select((.isLatest or .isDraft or .isPrerelease) | not) | { "tag": .tag.name, "commit": .tag.target.oid, "date": .tag.name[1+(.tag.name|index("-")):], "assets": { "limit": '"${GH_API_GQL_ASSETS}"', "totalCount": .releaseAssets.totalCount }, "files": .releaseAssets.nodes, "versions": [ .releaseAssets.nodes[].name | select(contains("-linux64-"))[1+index("-"):index("-linux64-")] ] } ]' ;
|
||||
{
|
||||
var='releases' ;
|
||||
delim='"'"${var}"'_EOF"' ;
|
||||
printf -- '%s<<%s\n' "${var}" "${delim}" ;
|
||||
gh api graphql --cache 12h \
|
||||
-F assets="${GH_API_GQL_ASSETS}" \
|
||||
-F owner="${GH_API_GQL_OWNER}" \
|
||||
-F repo="${GH_API_GQL_REPO}" \
|
||||
-F releases="${GH_API_GQL_RELEASES}" \
|
||||
-f query="${gql_query}" --jq "${gql_jq}" ;
|
||||
printf -- '%s\n' "${delim}" ;
|
||||
unset -v delim jq_arg var ;
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
gh api graphql --cache 12h \
|
||||
-F assets="${GH_API_GQL_ASSETS}" \
|
||||
-F owner="${GH_API_GQL_OWNER}" \
|
||||
-F repo="${GH_API_GQL_REPO}" \
|
||||
-F releases="${GH_API_GQL_RELEASES}" \
|
||||
-f query="${gql_query}" --jq "${gql_jq}" | jq '.[]' -- ;
|
||||
- name: Set environment variables with jq
|
||||
run: |
|
||||
cat >| .ffmpeg.releases.json <<'EOF'
|
||||
${{ steps.ffmpeg.outputs.releases }}
|
||||
${{ needs.info.outputs.ffmpeg-releases }}
|
||||
EOF
|
||||
{
|
||||
var='FFMPEG_DATE' ;
|
||||
@ -117,23 +124,17 @@ jobs:
|
||||
DOCKER_USERNAME: ${{ github.actor }}
|
||||
DOCKER_TOKEN: ${{ 'meeb' == github.repository_owner && secrets.REGISTRY_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
run: echo "${DOCKER_TOKEN}" | docker login --password-stdin --username "${DOCKER_USERNAME}" "${DOCKER_REGISTRY}"
|
||||
- name: Lowercase github username for ghcr
|
||||
id: string
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
with:
|
||||
string: ${{ github.actor }}
|
||||
- name: Build and push
|
||||
timeout-minutes: 60
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ 'success' == needs.test.result && 'meeb' == github.repository_owner && 'true' || 'false' }}
|
||||
tags: ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:latest
|
||||
cache-from: type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:latest
|
||||
tags: ghcr.io/${{ needs.info.outputs.string-lowercase }}/${{ env.IMAGE_NAME }}:latest
|
||||
cache-from: type=registry,ref=ghcr.io/${{ needs.info.outputs.string-lowercase }}/${{ env.IMAGE_NAME }}:latest
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
IMAGE_NAME=${{ env.IMAGE_NAME }}
|
||||
FFMPEG_DATE=${{ env.FFMPEG_DATE }}
|
||||
FFMPEG_VERSION=${{ env.FFMPEG_VERSION }}
|
||||
YTDLP_DATE=${{ needs.info.outputs.ytdlp_tag }}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user