Sync with restic by tag #5655
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: Sync with restic | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build: | |
name: Bump version and test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Pull tag | |
run: git fetch --tags | |
- name: Bump version | |
id: bump | |
run: ./bump.sh | |
continue-on-error: true | |
- name: Test local | |
id: test_local | |
run: ./test.sh local | |
if: steps.bump.outcome == 'success' | |
continue-on-error: true # workaround to make next step work | |
- name: Test S3 | |
id: test_s3 | |
run: ./test.sh s3 | |
if: steps.bump.outcome == 'success' | |
continue-on-error: true # workaround to make next step work | |
- name: Check tests results | |
id: check | |
if: steps.bump.outcome == 'success' && (steps.test_local.outcome != 'success' || steps.test_s3.outcome != 'success') | |
run: | | |
echo "tests failed" | |
exit 1 | |
- name: Build and push | |
if: steps.bump.outcome == 'success' | |
run: | | |
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag "ghcr.io/reddec/auto-restic:$(git describe --tags)" . | |
- name: Update tag if changed | |
run: | | |
git config --global user.email "${{github.actor}}@users.noreply.github.com" | |
git config --global user.name "${{github.actor}}" | |
git add -A | |
git commit -m "bump restic to $(git describe --tags)" | |
git push origin master | |
git push origin --tags | |
if: steps.bump.outcome == 'success' | |
- name: Create release | |
run: | | |
gh release create "$(git describe --tags)" --notes "* use restic version: $(git describe --tags)" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: steps.bump.outcome == 'success' |