Skip to content

Commit

Permalink
Merge pull request #197 from s3rj1k/ci-deb-packages
Browse files Browse the repository at this point in the history
Package handling changes.
  • Loading branch information
andywolk authored Jan 12, 2024
2 parents 66e49cd + acf203a commit 30c4333
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/cd-libs-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
sync:

runs-on: ${{ inputs.RUNNER }}
name: Sync metadata for ${{inputs.LIB_NAME}} at ${{inputs.FILE_PATH}}/${{inputs.ARTIFACT_NAME}}
name: Sync metadata for ${{ inputs.LIB_NAME }} at ${{ inputs.FILE_PATH }}/${{ inputs.ARTIFACT_NAME }}
environment: ${{ inputs.ENVIRONMENT }}

steps:
Expand All @@ -71,7 +71,7 @@ jobs:
id: metabranch
with:
repository: ${{ inputs.TARGET_REPO }}
ref: ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{inputs.TARGET_PLATFORM}}
ref: ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{ inputs.TARGET_PLATFORM }}
ssh-key: ${{ secrets.GH_BOT_DEPLOY_KEY }}
token: ${{ secrets.GH_BOT_DEPLOY_TOKEN || github.token }}

Expand All @@ -86,20 +86,22 @@ jobs:
- name: Create remote
continue-on-error: true
run: |
git checkout -b ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{inputs.TARGET_PLATFORM}}
git push --set-upstream origin ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{inputs.TARGET_PLATFORM}}
git checkout -b ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{ inputs.TARGET_PLATFORM }}
git push --set-upstream origin ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{ inputs.TARGET_PLATFORM }}
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.ARTIFACT_NAME }}

- name: Sync changes
shell: sh
run: |
git checkout ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{inputs.TARGET_PLATFORM}}
git checkout ${{ inputs.LIB_NAME }}/${{ inputs.TARGET_OS }}/${{ inputs.TARGET_PLATFORM }}
git pull
git status --porcelain && exit 0
git add metafile.txt
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git commit -m "update metadata"
git push
git push
13 changes: 8 additions & 5 deletions .github/workflows/ci-deb-packages-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ on:
description: Default base branch to create a PR.
BASE_IMAGE:
required: true
description: Base image used to build
description: Base image without tag used to build
type: string
DISTRO_CODENAME:
required: true
description: Base image tag used to build
type: string
PLATFORM:
required: false
Expand All @@ -44,7 +48,7 @@ jobs:
with:
fetch-depth: 0

- name: General debs based on ${{ inputs.BASE_IMAGE }} for ${{ inputs.PLATFORM }}
- name: General debs based on ${{ inputs.BASE_IMAGE }}:${{ inputs.DISTRO_CODENAME }} for ${{ inputs.PLATFORM }}
shell: sh
run: |
mkdir -v -p /tmp/$GITHUB_RUN_ID/
Expand Down Expand Up @@ -86,13 +90,12 @@ jobs:
uses: docker/setup-qemu-action@v3

- name: build debs
run: docker run --platform linux/${{inputs.PLATFORM}} --rm --entrypoint="/usr/local/bin/run.sh" -w /root -v $(pwd):/root -v /tmp/${GITHUB_RUN_ID}/run.sh:/usr/local/bin/run.sh ${{inputs.BASE_IMAGE}}
run: docker run --platform linux/${{ inputs.PLATFORM }} --rm --entrypoint="/usr/local/bin/run.sh" -w /root -v $(pwd):/root -v /tmp/${GITHUB_RUN_ID}/run.sh:/usr/local/bin/run.sh ${{ inputs.BASE_IMAGE }}:${{ inputs.DISTRO_CODENAME }}

- name: Set custom variables
shell: sh
run: |
codename=$(echo ${{inputs.BASE_IMAGE}} | awk -F ':' '{print $2}')
echo "IMAGE_TAG=$codename-${{inputs.PLATFORM}}" >> $GITHUB_ENV
echo "IMAGE_TAG=${{ inputs.DISTRO_CODENAME }}-${{ inputs.PLATFORM }}" >> $GITHUB_ENV
- name: Copy git hash
shell: sh
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-libs-metadata-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ on:
type: string
description: A GitHub runner type
ARTIFACT_NAME:
required: false
required: true
default: ''
description: The artifact name to pull from a previous step
type: string
FILE_PATH_PREFIX:
required: false
required: true
default: ''
description: A prefix to append to meta file.
type: string
OS_PLATFORM:
required: false
description: Default OS/Arch
required: true
description: OS/Codename/Arch
default: amd64
type: string
outputs:
Expand All @@ -38,7 +38,7 @@ jobs:
meta:

runs-on: ${{ inputs.RUNNER }}
name: Generate metadata for ${{inputs.LIB_NAME}}
name: Generate metadata for ${{ inputs.LIB_NAME }}
environment: ${{ inputs.ENVIRONMENT }}

steps:
Expand All @@ -60,6 +60,6 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: ${{inputs.OS_PLATFORM}}-meta
name: ${{ inputs.OS_PLATFORM }}-meta
path: |
metafile.txt

0 comments on commit 30c4333

Please sign in to comment.