ci: Upload release assets. (closes #54)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
43
.github/workflows/bake.yml
vendored
43
.github/workflows/bake.yml
vendored
@@ -58,6 +58,9 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
description: Fail-fast for the underlying matrix.
|
description: Fail-fast for the underlying matrix.
|
||||||
|
release_url:
|
||||||
|
type: string
|
||||||
|
description: Upload url for created release.
|
||||||
artifact:
|
artifact:
|
||||||
type: string
|
type: string
|
||||||
default: '{}'
|
default: '{}'
|
||||||
@@ -177,6 +180,28 @@ jobs:
|
|||||||
mkdir -p "_artifact"
|
mkdir -p "_artifact"
|
||||||
mv "$src" "_artifact/$dst"
|
mv "$src" "_artifact/$dst"
|
||||||
|
|
||||||
|
# Optionally compress extracted artifact
|
||||||
|
- name: Compress Artifact
|
||||||
|
if: >
|
||||||
|
!failure() && !cancelled()
|
||||||
|
&& fromJSON(inputs.artifact)[matrix.bake_target].dst
|
||||||
|
&& (fromJSON(inputs.artifact)[matrix.bake_target].gzip || fromJSON(inputs.artifact)[matrix.bake_target].zstd)
|
||||||
|
|
||||||
|
env:
|
||||||
|
dst: ${{ fromJSON(inputs.artifact)[matrix.bake_target].dst }}
|
||||||
|
gzlev: ${{ fromJSON(inputs.artifact)[matrix.bake_target].gzip }}
|
||||||
|
zstlev: ${{ fromJSON(inputs.artifact)[matrix.bake_target].zstd }}
|
||||||
|
|
||||||
|
run: |
|
||||||
|
if test -n "$gzlev"; then
|
||||||
|
mv "_artifact/$dst" "_artifact/foo"
|
||||||
|
gzip "-$gzlev" "_artifact/foo"
|
||||||
|
mv "_artifact/foo.gz" "_artifact/$dst"
|
||||||
|
elif test -n "$zstlev"; then
|
||||||
|
zstd "-$zstlev" "_artifact/$dst"
|
||||||
|
mv "_artifact/$dst.zst" "_artifact/$dst"
|
||||||
|
fi
|
||||||
|
|
||||||
# Upload either artifact
|
# Upload either artifact
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
if: >
|
if: >
|
||||||
@@ -199,3 +224,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: _artifact/${{fromJSON(inputs.artifact)[matrix.bake_target].dst}}
|
path: _artifact/${{fromJSON(inputs.artifact)[matrix.bake_target].dst}}
|
||||||
name: github-pages
|
name: github-pages
|
||||||
|
|
||||||
|
# Optionally upload artifact as release-artifact
|
||||||
|
- name: Upload Release Artifact
|
||||||
|
if: >
|
||||||
|
!failure() && !cancelled()
|
||||||
|
&& fromJSON(inputs.artifact)[matrix.bake_target].dst
|
||||||
|
&& fromJSON(inputs.artifact)[matrix.bake_target].mime
|
||||||
|
&& contains(github.ref, 'refs/tags/v')
|
||||||
|
&& inputs.release_url
|
||||||
|
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
with:
|
||||||
|
upload_url: ${{inputs.release_url}}
|
||||||
|
asset_path: _artifact/${{fromJSON(inputs.artifact)[matrix.bake_target].dst}}
|
||||||
|
asset_name: ${{github.ref_name}}-${{matrix.cargo_profile}}-${{matrix.feat_set}}-${{fromJSON(inputs.artifact)[matrix.bake_target].dst}}
|
||||||
|
asset_content_type: ${{fromJSON(inputs.artifact)[matrix.bake_target].mime || 'application/octet-stream'}}
|
||||||
|
|||||||
19
.github/workflows/main.yml
vendored
19
.github/workflows/main.yml
vendored
@@ -38,6 +38,7 @@ jobs:
|
|||||||
sys_targets: ${{vars.SYS_TARGETS || env.default_sys_targets}}
|
sys_targets: ${{vars.SYS_TARGETS || env.default_sys_targets}}
|
||||||
sys_versions: ${{vars.SYS_VERSIONS || env.default_sys_versions}}
|
sys_versions: ${{vars.SYS_VERSIONS || env.default_sys_versions}}
|
||||||
machines: ${{vars.MACHINES || env.default_machines}}
|
machines: ${{vars.MACHINES || env.default_machines}}
|
||||||
|
release_url: ${{steps.release.outputs.upload_url}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Initialize Builder
|
- name: Initialize Builder
|
||||||
@@ -72,6 +73,22 @@ jobs:
|
|||||||
--name "${GITHUB_ACTOR}" \
|
--name "${GITHUB_ACTOR}" \
|
||||||
--buildkitd-flags "--allow-insecure-entitlement network.host"
|
--buildkitd-flags "--allow-insecure-entitlement network.host"
|
||||||
|
|
||||||
|
- if: >
|
||||||
|
!failure() && !cancelled()
|
||||||
|
&& contains(github.ref, 'refs/tags/v')
|
||||||
|
|
||||||
|
id: release
|
||||||
|
name: Create Release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
with:
|
||||||
|
release_name: Release ${{github.ref_name}}
|
||||||
|
tag_name: ${{github.ref}}
|
||||||
|
body_path: NEWS.md
|
||||||
|
draft: ${{ contains(github.ref, '-draft') }}
|
||||||
|
prerelease: ${{ contains(github.ref, '-rc') }}
|
||||||
|
|
||||||
## commented due to https://github.com/orgs/community/discussions/18001
|
## commented due to https://github.com/orgs/community/discussions/18001
|
||||||
#deps:
|
#deps:
|
||||||
# if: ${{fromJSON(vars.CI_VERBOSE_DEPS || 'false')}}
|
# if: ${{fromJSON(vars.CI_VERBOSE_DEPS || 'false')}}
|
||||||
@@ -157,6 +174,7 @@ jobs:
|
|||||||
needs: [init, lint]
|
needs: [init, lint]
|
||||||
uses: ./.github/workflows/package.yml
|
uses: ./.github/workflows/package.yml
|
||||||
with:
|
with:
|
||||||
|
release_url: ${{needs.init.outputs.release_url}}
|
||||||
cargo_profiles: ${{needs.init.outputs.cargo_profiles}}
|
cargo_profiles: ${{needs.init.outputs.cargo_profiles}}
|
||||||
feat_sets: ${{needs.init.outputs.feat_sets}}
|
feat_sets: ${{needs.init.outputs.feat_sets}}
|
||||||
rust_toolchains: ${{needs.init.outputs.rust_toolchains}}
|
rust_toolchains: ${{needs.init.outputs.rust_toolchains}}
|
||||||
@@ -189,6 +207,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/publish.yml
|
uses: ./.github/workflows/publish.yml
|
||||||
with:
|
with:
|
||||||
docker_repo: ${{vars.DOCKER_REPO}}
|
docker_repo: ${{vars.DOCKER_REPO}}
|
||||||
|
release_url: ${{needs.init.outputs.release_url}}
|
||||||
cargo_profiles: ${{needs.init.outputs.cargo_profiles}}
|
cargo_profiles: ${{needs.init.outputs.cargo_profiles}}
|
||||||
feat_sets: ${{needs.init.outputs.feat_sets}}
|
feat_sets: ${{needs.init.outputs.feat_sets}}
|
||||||
rust_toolchains: ${{needs.init.outputs.rust_toolchains}}
|
rust_toolchains: ${{needs.init.outputs.rust_toolchains}}
|
||||||
|
|||||||
46
.github/workflows/package.yml
vendored
46
.github/workflows/package.yml
vendored
@@ -35,6 +35,9 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
default: '[]'
|
default: '[]'
|
||||||
description: Matrix inclusions
|
description: Matrix inclusions
|
||||||
|
release_url:
|
||||||
|
type: string
|
||||||
|
description: For release assets
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
book:
|
book:
|
||||||
@@ -58,9 +61,14 @@ jobs:
|
|||||||
machines: ${{inputs.machines}}
|
machines: ${{inputs.machines}}
|
||||||
excludes: ${{inputs.excludes}}
|
excludes: ${{inputs.excludes}}
|
||||||
includes: ${{inputs.includes}}
|
includes: ${{inputs.includes}}
|
||||||
|
release_url: ${{inputs.release_url}}
|
||||||
artifact: >
|
artifact: >
|
||||||
{
|
{
|
||||||
"book": {"dst": "book", "src": "/book", "pages": true},
|
"book": {
|
||||||
|
"dst": "book",
|
||||||
|
"src": "/book",
|
||||||
|
"pages": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binary:
|
binary:
|
||||||
@@ -81,9 +89,15 @@ jobs:
|
|||||||
machines: ${{inputs.machines}}
|
machines: ${{inputs.machines}}
|
||||||
excludes: ${{inputs.excludes}}
|
excludes: ${{inputs.excludes}}
|
||||||
includes: ${{inputs.includes}}
|
includes: ${{inputs.includes}}
|
||||||
|
release_url: ${{inputs.release_url}}
|
||||||
artifact: >
|
artifact: >
|
||||||
{
|
{
|
||||||
"static": {"dst": "tuwunel", "src": "/usr/bin/tuwunel" },
|
"static": {
|
||||||
|
"dst": "tuwunel.zst",
|
||||||
|
"src": "/usr/bin/tuwunel",
|
||||||
|
"mime": "application/zstd",
|
||||||
|
"zstd": 11
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
container:
|
container:
|
||||||
@@ -104,10 +118,21 @@ jobs:
|
|||||||
machines: ${{inputs.machines}}
|
machines: ${{inputs.machines}}
|
||||||
excludes: ${{inputs.excludes}}
|
excludes: ${{inputs.excludes}}
|
||||||
includes: ${{inputs.includes}}
|
includes: ${{inputs.includes}}
|
||||||
|
release_url: ${{inputs.release_url}}
|
||||||
artifact: >
|
artifact: >
|
||||||
{
|
{
|
||||||
"docker": {"dst": "tuwunel-docker.tar.gz", "img": true },
|
"docker": {
|
||||||
"oci": {"dst": "tuwunel-oci.tar.zst", "runner": true }
|
"dst": "tuwunel-docker.tar.gz",
|
||||||
|
"img": true,
|
||||||
|
"mime": "application/gzip",
|
||||||
|
"gzip": 7
|
||||||
|
},
|
||||||
|
"oci": {
|
||||||
|
"dst": "tuwunel-oci.tar.zst",
|
||||||
|
"runner": true,
|
||||||
|
"mime": "application/zstd",
|
||||||
|
"zstd": 11
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgs:
|
pkgs:
|
||||||
@@ -131,10 +156,19 @@ jobs:
|
|||||||
machines: ${{inputs.machines}}
|
machines: ${{inputs.machines}}
|
||||||
excludes: ${{inputs.excludes}}
|
excludes: ${{inputs.excludes}}
|
||||||
includes: ${{inputs.includes}}
|
includes: ${{inputs.includes}}
|
||||||
|
release_url: ${{inputs.release_url}}
|
||||||
artifact: >
|
artifact: >
|
||||||
{
|
{
|
||||||
"pkg-deb": {"dst": "tuwunel.deb", "src": "tuwunel_1.0.0-1_amd64.deb"},
|
"pkg-deb": {
|
||||||
"pkg-rpm": {"dst": "tuwunel.rpm", "src": "tuwunel-1.0.0-1.x86_64.rpm"}
|
"dst": "tuwunel.deb",
|
||||||
|
"src": "tuwunel_1.0.0-1_amd64.deb",
|
||||||
|
"mime": "application/vnd.debian.binary-package"
|
||||||
|
},
|
||||||
|
"pkg-rpm": {
|
||||||
|
"dst": "tuwunel.rpm",
|
||||||
|
"src": "tuwunel-1.0.0-1.x86_64.rpm",
|
||||||
|
"mime": "application/x-rpm"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_pkgs:
|
check_pkgs:
|
||||||
|
|||||||
15
.github/workflows/publish.yml
vendored
15
.github/workflows/publish.yml
vendored
@@ -2,6 +2,9 @@ name: Publish
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
ghcr_token:
|
||||||
|
dockerhub_token:
|
||||||
inputs:
|
inputs:
|
||||||
cargo_profiles:
|
cargo_profiles:
|
||||||
type: string
|
type: string
|
||||||
@@ -38,16 +41,17 @@ on:
|
|||||||
docker_repo:
|
docker_repo:
|
||||||
type: string
|
type: string
|
||||||
description: DockerHub Repository
|
description: DockerHub Repository
|
||||||
secrets:
|
release_url:
|
||||||
ghcr_token:
|
type: string
|
||||||
dockerhub_token:
|
description: For release assets
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
documents:
|
documents:
|
||||||
if: >
|
if: >
|
||||||
!failure() && !cancelled()
|
!failure() && !cancelled()
|
||||||
&& inputs.machines
|
&& inputs.machines
|
||||||
&& github.ref == 'refs/heads/main'
|
&& (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
|
||||||
|
&& !contains(github.ref, '-draft')
|
||||||
|
|
||||||
name: Documents
|
name: Documents
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
@@ -66,6 +70,7 @@ jobs:
|
|||||||
&& inputs.machines
|
&& inputs.machines
|
||||||
&& inputs.docker_repo != ''
|
&& inputs.docker_repo != ''
|
||||||
&& (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
|
&& (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
|
||||||
|
&& !contains(github.ref, '-draft')
|
||||||
|
|
||||||
name: Containers
|
name: Containers
|
||||||
runs-on: ${{matrix.machine}}
|
runs-on: ${{matrix.machine}}
|
||||||
@@ -115,8 +120,8 @@ jobs:
|
|||||||
acct: ${{github.actor}}
|
acct: ${{github.actor}}
|
||||||
repo: ${{github.repository}}
|
repo: ${{github.repository}}
|
||||||
docker_repo: ${{inputs.docker_repo}}
|
docker_repo: ${{inputs.docker_repo}}
|
||||||
|
docker_tag_preview: ${{ contains(github.ref, 'refs/tags/v') }}
|
||||||
docker_tag_latest: ${{ contains(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc') }}
|
docker_tag_latest: ${{ contains(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc') }}
|
||||||
docker_tag_preview: ${{ contains(github.ref, 'refs/tags/v') && contains(github.ref, '-rc') }}
|
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
docker/bake.sh "${{matrix.bake_target}}"
|
docker/bake.sh "${{matrix.bake_target}}"
|
||||||
|
|||||||
Reference in New Issue
Block a user