From f0e84157968cbf2a11687c5cbde0e2ca9e0d55a7 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 15:54:20 +0000 Subject: [PATCH 1/7] test publish --- .github/workflows/test.yml | 32 +++++++++++++++--------- publish/action.yml | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 publish/action.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ba4192..3451cc7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,16 +10,16 @@ jobs: matrix: target: - debian:10 - - debian:11 - - debian:12 - - ubuntu:20.04 - - ubuntu:22.04 - - ubuntu:24.04 - - el:7 - - el:8 - - el:9 - - sles:12 - - sles:15 + # - debian:11 + # - debian:12 + # - ubuntu:20.04 + # - ubuntu:22.04 + # - ubuntu:24.04 + # - el:7 + # - el:8 + # - el:9 + # - sles:12 + # - sles:15 steps: - uses: actions/checkout@v4 @@ -33,12 +33,20 @@ jobs: - uses: ./action/package id: package with: - name: blank-sinatra-app target: ${{ matrix.target }} + name: blank-sinatra-app version: '1.0.0' path: app - name: Upload uses: actions/upload-artifact@v4 with: name: ${{ steps.package.outputs.package_name }} - path: ${{ steps.package.outputs.package_path }} \ No newline at end of file + path: ${{ steps.package.outputs.package_path }} + - name: Publish + uses: ./action/publish + with: + target: ${{ matrix.target }} + token: ${{ secrets.PUBLISH_TOKEN }} + repository: crohr/blank-sinatra-app + channel: master + artefact: ${{ steps.package.outputs.package_path }} \ No newline at end of file diff --git a/publish/action.yml b/publish/action.yml new file mode 100644 index 0000000..0884c57 --- /dev/null +++ b/publish/action.yml @@ -0,0 +1,50 @@ +name: 'pkgr/action/publish' +description: 'Publish your package to the packagehall' +inputs: + artefact: + description: 'Artefact to publish' + required: true + target: + description: 'Distribution' + required: true + repository: + description: 'Repository to publish to' + required: true + default: '${{ github.repository }}' + channel: + description: 'Channel to publish to' + required: true + default: 'master' + token: + description: 'Token to use for authentication' + required: true + force: + description: 'Publish even if the artefact already exists, and auto-create the channel if it does not exist' + required: false + default: "true" + +outputs: + id: + description: "Package identifier" + value: ${{ steps.upload.outputs.id }} + +runs: + using: "composite" + steps: + - name: Upload + id: upload + shell: bash + env: + REPO_FULL_NAME: ${{ inputs.repository }} + TARGET: ${{ inputs.target }} + CHANNEL: ${{ inputs.channel }} + run: | + org="${REPO_FULL_NAME%%/*}" + repo="${REPO_FULL_NAME##*/}" + url="https://dl.packager.io/api/orgs/${org}/repos/${repo}/packages" + echo "Pushing to ${url}..." + curl --fail-with-body -u "${{ inputs.token }}" -i -X POST "${url}" \ + -F "artefact=@${{ inputs.artefact }}" \ + -F "targets[]=${TARGET/://}" \ + -F "channels[]=$CHANNEL" \ + -F "force=${{ inputs.force }}" \ No newline at end of file From 5150f5d2d94cea3f03ada60e5f086f6c581511e0 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 18:14:04 +0000 Subject: [PATCH 2/7] fix --- .github/workflows/test.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3451cc7..63f2bd4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,16 +10,16 @@ jobs: matrix: target: - debian:10 - # - debian:11 - # - debian:12 - # - ubuntu:20.04 - # - ubuntu:22.04 - # - ubuntu:24.04 - # - el:7 - # - el:8 - # - el:9 - # - sles:12 - # - sles:15 + - debian:11 + - debian:12 + - ubuntu:20.04 + - ubuntu:22.04 + - ubuntu:24.04 + - el:7 + - el:8 + - el:9 + - sles:12 + - sles:15 steps: - uses: actions/checkout@v4 From e20c5b29cd7993f25724f7d88feb46dace0c36a7 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 19:23:42 +0000 Subject: [PATCH 3/7] fix --- package/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/action.yml b/package/action.yml index ec852eb..58fb8c4 100644 --- a/package/action.yml +++ b/package/action.yml @@ -80,6 +80,8 @@ runs: -v .:/pkgr/app \ -v $workspace/cache:/pkgr/cache \ -v $workspace/output:/pkgr/output \ + --net=host \ + -e DATABASE_URL -e REDIS_URL \ ghcr.io/crohr/pkgr/${{ inputs.target }}-${{ inputs.pkgr_version }} \ --name "${{ inputs.name }}" --version "${{ inputs.version }}" --iteration "${{ steps.setup.outputs.iteration }}" From e970331c79b433ceb1f56a4c84ae58a70e67cb16 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 19:29:33 +0000 Subject: [PATCH 4/7] fix --- package/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/package/action.yml b/package/action.yml index 58fb8c4..3497b4c 100644 --- a/package/action.yml +++ b/package/action.yml @@ -68,6 +68,7 @@ runs: with: path: ${{ steps.setup.outputs.workspace }}/cache key: pkgr-${{ inputs.cache_prefix }}-${{ inputs.target }}-${{ inputs.pkgr_version }} + save-always: true - name: Package shell: bash From 34a9aeddad85ed7a7a9aee75f06b2d29962f4bd9 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 19:42:19 +0000 Subject: [PATCH 5/7] fix --- package/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/action.yml b/package/action.yml index 3497b4c..be63f8b 100644 --- a/package/action.yml +++ b/package/action.yml @@ -76,6 +76,8 @@ runs: run: | workspace=${{ steps.setup.outputs.workspace }} + env | grep DATABASE_URL + cd ${{ inputs.path }} docker run --rm \ -v .:/pkgr/app \ From ede4b04c4cbb657a55e77ad8b850357217b21c9f Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 19:54:35 +0000 Subject: [PATCH 6/7] fix --- package/action.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/action.yml b/package/action.yml index be63f8b..f78b37b 100644 --- a/package/action.yml +++ b/package/action.yml @@ -24,6 +24,10 @@ inputs: description: 'Prefix for the cache' required: true default: 'v1' + env: + description: 'Environment variables to pass to pkgr' + required: false + default: '' outputs: workspace: @@ -76,17 +80,14 @@ runs: run: | workspace=${{ steps.setup.outputs.workspace }} - env | grep DATABASE_URL - cd ${{ inputs.path }} docker run --rm \ -v .:/pkgr/app \ -v $workspace/cache:/pkgr/cache \ -v $workspace/output:/pkgr/output \ --net=host \ - -e DATABASE_URL -e REDIS_URL \ ghcr.io/crohr/pkgr/${{ inputs.target }}-${{ inputs.pkgr_version }} \ - --name "${{ inputs.name }}" --version "${{ inputs.version }}" --iteration "${{ steps.setup.outputs.iteration }}" + --name "${{ inputs.name }}" --version "${{ inputs.version }}" --iteration "${{ steps.setup.outputs.iteration }}" --env "${{ inputs.env }}" package_path="" if [ -f $workspace/output/*.deb ]; then From 8e417ffebd0963d9b4e73fdd22050a4b695c9f38 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 30 May 2024 20:07:43 +0000 Subject: [PATCH 7/7] fix --- .github/workflows/test.yml | 1 + package/action.yml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63f2bd4..d6061b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,7 @@ jobs: name: blank-sinatra-app version: '1.0.0' path: app + debug: true - name: Upload uses: actions/upload-artifact@v4 with: diff --git a/package/action.yml b/package/action.yml index f78b37b..2430b83 100644 --- a/package/action.yml +++ b/package/action.yml @@ -28,6 +28,10 @@ inputs: description: 'Environment variables to pass to pkgr' required: false default: '' + debug: + description: 'Debug mode' + required: false + default: 'false' outputs: workspace: @@ -87,7 +91,7 @@ runs: -v $workspace/output:/pkgr/output \ --net=host \ ghcr.io/crohr/pkgr/${{ inputs.target }}-${{ inputs.pkgr_version }} \ - --name "${{ inputs.name }}" --version "${{ inputs.version }}" --iteration "${{ steps.setup.outputs.iteration }}" --env "${{ inputs.env }}" + --name "${{ inputs.name }}" --version "${{ inputs.version }}" --iteration "${{ steps.setup.outputs.iteration }}" --env "${{ inputs.env }}" --debug=${{ inputs.debug }} package_path="" if [ -f $workspace/output/*.deb ]; then