Build Unstable Image #1065
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 Unstable Image | |
on: | |
schedule: | |
- cron: 0 2 * * * | |
workflow_dispatch: | |
jobs: | |
check_date: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: check latest commit is less than a day | |
if: ${{ github.event_name == 'schedule' }} | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false" | |
audioserve-build: | |
runs-on: ubuntu-22.04 | |
needs: check_date | |
if: ${{ needs.check_date.outputs.should_run != 'false' }} | |
steps: | |
- name: Check docker | |
run: | | |
echo "Starting build" | |
docker --version | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Build image | |
run: docker build --tag izderadicka/audioserve:unstable --build-arg CARGO_ARGS="--features=transcoding-cache,collation" . | |
- name: Publish image | |
run: | | |
docker login -u ${{secrets.DOCKERHUB_USER}} -p ${{secrets.DOCKERHUB_PASSWORD}} | |
docker push izderadicka/audioserve:unstable | |
- name: ssh to VM and redeploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: audioserve.zderadicka.eu | |
username: ${{ secrets.AUDIOSERVE_USERNAME }} | |
key: ${{ secrets.AUDIOSERVE_KEY }} | |
script: | | |
docker stop -t 30 audioserve || true | |
docker rm -f audioserve || true | |
docker pull izderadicka/audioserve:unstable | |
./run-audioserve.sh | |