Create LICENSE #9
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: Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Read the current version | |
id: get_version | |
run: echo "::set-output name=version::$(cat VERSION)" | |
- name: Increment the version | |
id: increment_version | |
run: | | |
current_version=$(cat VERSION) | |
IFS='.' read -r -a version_parts <<< "$current_version" | |
version_parts[2]=$((version_parts[2] + 1)) | |
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" | |
echo $new_version > VERSION | |
echo "::set-output name=new_version::$new_version" | |
- name: Commit the new version | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add VERSION | |
git commit -m "Increment version to ${{ steps.increment_version.outputs.new_version }}" | |
git push | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} | |
- name: Verification step | |
run: | | |
# Run Calibre version command to verify installation | |
docker run --rm calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} ebook-convert --version | |
# Run Puppeteer to verify installation | |
# docker run --rm --security-opt seccomp=chrome.json calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} node -e "const browser = require('puppeteer').launch(); console.log('Puppeteer works')" | |
- name: Push Docker image | |
run: | | |
docker logout | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
docker tag calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} athrvk/calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} | |
docker tag calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} athrvk/calibre-puppeteer-base:latest | |
docker push athrvk/calibre-puppeteer-base:${{ steps.increment_version.outputs.new_version }} | |
docker push athrvk/calibre-puppeteer-base:latest |