This commit is contained in:
kokomo123
2024-08-25 02:33:57 +00:00
committed by GitHub

View File

@@ -17,27 +17,27 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
create-release: #create-release:
runs-on: ubuntu-latest #runs-on: ubuntu-latest
steps: #steps:
- uses: actions/checkout@master # - uses: actions/checkout@master
- name: Archive Images # - name: Archive Images
run: | # run: |
rm -rf docker Dockerfile # rm -rf docker Dockerfile
mkdir -p img # mkdir -p img
ls | grep -v img | xargs mv -t img # ls | grep -v img | xargs mv -t img
zip -r -s 500m img-${{ github.ref_name }}.zip img/ # zip -r -s 500m img-${{ github.ref_name }}.zip img/
- name: Upload Release # - name: Upload Release
# Add the files one-by-one in an effort to avoid timeouts # Add the files one-by-one in an effort to avoid timeouts
# Sleep between creating the release and adding files, as the release takes time to be created (?) # Sleep between creating the release and adding files, as the release takes time to be created (?)
run: | # run: |
gh release create "${{github.ref_name}}" --title "${{github.ref_name}}" --notes "Version ${{ github.ref_name }}" # gh release create "${{github.ref_name}}" --title "${{github.ref_name}}" --notes "Version ${{ github.ref_name }}"
sleep 10 # sleep 10
for f in $(find . -name 'img-${{ github.ref_name }}.*' -print); do gh release upload ${{ github.ref_name }} $f; done # for f in $(find . -name 'img-${{ github.ref_name }}.*' -print); do gh release upload ${{ github.ref_name }} $f; done
env: # env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-image: create-image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -55,20 +55,37 @@ jobs:
echo "IMAGE_ID=$(echo ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV echo "IMAGE_ID=$(echo ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV
# region See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio # region See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
- name: Build Image - name: Use QEMU
run: | uses: docker/setup-qemu-action@master
docker build -t $IMAGE_NAME . with:
platforms: all
- name: Free Disk Space (Ubuntu)
uses: insightsengineering/disk-space-reclaimer@v1
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tools-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
docker-images: false
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Log In to Registry - name: Log In to Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push Image - name: Build the docker image
run: | uses: docker/build-push-action@master
echo IMAGE_ID=$IMAGE_ID with:
echo IMAGE_VERSION=$IMAGE_VERSION context: .
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_VERSION builder: ${{ steps.buildx.outputs.name }}
# Always tag latest when pushing a tag, as we don't expect to ever merge old tags platforms: linux/arm64,linux/amd64
[[ "${{ github.ref }}" == "refs/tags/"* ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest push: true
docker push $IMAGE_ID:$IMAGE_VERSION tags: ghcr.io/kokomo123/5etools-img:latest
docker push $IMAGE_ID:latest
# endregion # endregion