Added shrink functionality to export, updated README (confirmed RPi 5… #148
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: PI-CI | |
on: [push] | |
env: | |
IMAGE_NAME: ptrsr/pi-ci | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Free up disk space on github runner | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
# android: false | |
# dotnet: false | |
# haskell: false | |
# large-packages: false | |
# swap-storage: false | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache register | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/image.tar | |
key: ${{ hashFiles('dockerfile') }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
run: | | |
docker buildx build \ | |
-t ${{ env.IMAGE_NAME }} \ | |
-o type=docker,dest=- \ | |
. > /tmp/image.tar | |
test: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache register | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/image.tar | |
key: ${{ hashFiles('dockerfile') }} | |
- name: Load Docker image | |
run: docker load -i /tmp/image.tar | |
- name: Install dependencies | |
run: | | |
sudo apt-get install ansible | |
pip3 install docker-py | |
- name: Run test | |
run: | | |
ansible-playbook \ | |
-i test/hosts.yml \ | |
test/main.yml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: config | |
path: dist | |
publish: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-22.04 | |
environment: docker-hub | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set tag variable | |
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Cache register | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/image.tar | |
key: ${{ hashFiles('dockerfile') }} | |
- name: Load Docker image | |
run: docker load -i /tmp/image.tar | |
- name: Tag docker image | |
run: docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Push to Docker Hub | |
run: docker push -a ${{ env.IMAGE_NAME }} |