chore(deps): update docker/build-push-action action to v6.5.0 #52
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: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
- opened | |
- reopened | |
- synchronize | |
- auto_merge_enabled | |
schedule: | |
- cron: '00 02 1 * *' | |
workflow_dispatch: {} | |
jobs: | |
builds: | |
name: WSL2 build | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: write | |
packages: write | |
env: | |
COMMIT_SHORT_SHA: null | |
steps: | |
- name: Checkout from repository | |
uses: actions/checkout@v4.1.7 | |
- name: Set short git commit SHA | |
run: |+ | |
set -eux | |
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/naa0yama/devtool-wsl2 | |
flavor: | | |
latest=false | |
tags: | | |
type=ref,event=tag,prefix=,enable=true | |
# minimal (short sha) | |
type=sha,enable=true,prefix=,format=short | |
- 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: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6.5.0 | |
with: | |
context: . | |
file: Dockerfile | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=tar,dest=devtool-wsl2-${{ env.COMMIT_SHORT_SHA }}.tar | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Cleanup pre-releases | |
uses: actions/github-script@v7.0.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: |+ | |
const __prereleases = await github.rest.repos.listReleases({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
per_page: 100, | |
}); | |
const prereleases = __prereleases.data | |
for (const index in prereleases) { | |
if (prereleases[index].draft == true && | |
prereleases[index].prerelease == true ) { | |
console.log('delte pre-release ' + prereleases[index]['id'] + '\t' + prereleases[index]['name']) | |
await github.rest.repos.deleteRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: prereleases[index]['id'], | |
}); | |
} | |
} | |
console.log('end run') | |
- name: Split archive file. | |
run: |+ | |
set -eux | |
TEMP_EXTRACT=$(mktemp -d) | |
gzip "devtool-wsl2-${{ env.COMMIT_SHORT_SHA }}.tar" | |
split --verbose --numeric-suffixes --bytes=2000M --suffix-length=1 \ | |
devtool-wsl2-${{ env.COMMIT_SHORT_SHA }}.tar.gz \ | |
devtool-wsl2-${{ env.COMMIT_SHORT_SHA }}.tar.gz.part | |
ls -lah | |
- name: Pre-Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: devtool-WSL2 image ${{ env.COMMIT_SHORT_SHA }} | |
tag_name: ${{ env.COMMIT_SHORT_SHA }} | |
generate_release_notes: true | |
draft: true | |
prerelease: true | |
files: | | |
./devtool-wsl2-${{ env.COMMIT_SHORT_SHA }}.tar.gz.part* |