mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-08-01 23:17:49 +00:00
75 lines
2.6 KiB
YAML
75 lines
2.6 KiB
YAML
# publish changes that are merged to master
|
|
name: Packages Push
|
|
on:
|
|
workflow_run:
|
|
workflows: [LinuxKit CI]
|
|
types: [completed]
|
|
branches: [master, main]
|
|
|
|
jobs:
|
|
packages:
|
|
env:
|
|
linuxkit_file: linuxkit-amd64-linux
|
|
name: Publish Changed Packages
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
- name: Ensure bin/ directory
|
|
run: mkdir -p bin
|
|
- name: Download linuxkit
|
|
uses: actions/github-script@v7
|
|
with:
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
script: |
|
|
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{github.event.workflow_run.id }},
|
|
});
|
|
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
|
return artifact.name == "${{ env.linuxkit_file }}"
|
|
})[0];
|
|
var download = await github.rest.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: matchArtifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
var fs = require('fs');
|
|
fs.writeFileSync('${{github.workspace}}/bin/${{ env.linuxkit_file }}.zip', Buffer.from(download.data));
|
|
- name: unzip linuxkit
|
|
run: cd bin && unzip ${{ env.linuxkit_file }}.zip
|
|
- name: Symlink Linuxkit
|
|
run: |
|
|
chmod ugo+x bin/${{ env.linuxkit_file }}
|
|
sudo ln -s $(pwd)/bin/${{ env.linuxkit_file }} /usr/local/bin/linuxkit
|
|
/usr/local/bin/linuxkit version
|
|
- name: Restore Package Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.linuxkit/cache/
|
|
key: ${{ runner.os }}-linuxkit-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-linuxkit-
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Publish Packages
|
|
# this should only push changed ones:
|
|
# - unchanged: already in the registry
|
|
# - changed: already built and cached, so only will push
|
|
# Skip s390x as emulation is unreliable
|
|
run: |
|
|
make OPTIONS="--skip-platforms linux/s390x" -C pkg push PUSHOPTIONS="--nobuild"
|
|
|
|
- name: Publish Kernels
|
|
# this should only push changed ones:
|
|
# - unchanged: already in the registry
|
|
# - changed: already built and cached, so only will push
|
|
# No need to skip s390x, since kernel build.yml files all have explicit archs
|
|
run: |
|
|
make -C kernel push
|