fix backup step in cicd #954
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
setup-vars: | |
name: Setup variables | |
runs-on: ubuntu-latest | |
outputs: | |
now_tag: ${{ steps.set-variables.outputs.now_tag }} | |
steps: | |
- id: set-variables | |
name: Setup variables | |
shell: bash | |
run: | | |
echo "now_tag=RELEASE.$(TZ=UTC date +'%Y-%m-%dT%H-%M-%SZ')" >> "$GITHUB_OUTPUT" | |
cicl: | |
name: Cicl | |
runs-on: ubuntu-latest | |
needs: [setup-vars] | |
outputs: | |
version: ${{ steps.properties.outputs.version }} | |
changelog: ${{ steps.properties.outputs.changelog }} | |
steps: | |
- name: Backup docker files | |
run: | | |
echo "backup moby/buildkit image" | |
if sudo docker image inspect moby/buildkit > /dev/null 2>&1; then | |
sudo docker image save -o ${GITHUB_WORKSPACE}/images.tar moby/buildkit | |
else | |
echo "moby/buildkit image does not exist, skipping backup" | |
fi | |
echo "Back up /var/lib/docker folder structure and other files" | |
sudo rsync -aPq /var/lib/docker/ ${GITHUB_WORKSPACE}/docker | |
# Free GitHub Actions Environment Disk Space | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 512 | |
temp-reserve-mb: 32 | |
swap-size-mb: 32 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
build-mount-path: '/var/lib/docker/' | |
- name: Restore docker files | |
run: | | |
sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker | |
sudo rm -rf ${GITHUB_WORKSPACE}/docker | |
sudo ls ${GITHUB_WORKSPACE} -l | |
sudo docker image load -i ${GITHUB_WORKSPACE}/images.tar | |
sudo rm ${GITHUB_WORKSPACE}/images.tar | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Inject cache docker image | |
run: | | |
./.github/scripts/cicl_docker_injection.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USER }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
push: false | |
load: true | |
context: . | |
tags: | | |
smallcloud/refact_self_hosting:${{ needs.setup-vars.outputs.now_tag }} | |
platforms: | | |
linux/amd64 |