Skip to content

Merge pull request #60 from madiele/main #64

Merge pull request #60 from madiele/main

Merge pull request #60 from madiele/main #64

Workflow file for this run

name: stable image
on:
push:
branches: [ stable ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency: ${{ github.head_ref || github.ref_name }}
jobs:
cargo_version_bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump patch version
run: |
# Get the current version
VERSION=$(grep -oP '^version = "\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml)
# Bump the minor version
NEW_VERSION=$(echo $VERSION | awk -F "." '{print $1"."$2"."($3+1)}')
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
# Replace the old version with the new version
sed -i "s/^version = \"$VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml
shell: bash
- name: Commit and push changes
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Action"
git tag -a v$VERSION -m "version $VERSION"
git commit -a -m "Bump patch version to $NEW_VERSION"
git push origin HEAD --follow-tags
git fetch --unshallow
git checkout main
git merge stable
git push origin HEAD --follow-tags
git checkout stable
push_to_Docker_Hub_amd64:
needs: cargo_version_bump
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: Bump patch version
run: |
# Get the current version
VERSION=$(grep -oP '^version = "\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: remove dev deps and version (for cache purposes)
run: |
sh .github/workflows/remove_dev_deps_and_version.sh
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-amd64
platforms: linux/amd64
cache-from: type=gha,scope=main-amd64
cache-to: type=gha,mode=max,scope=main-amd64
build-args: |
BUILDKIT_INLINE_CACHE=1
push_to_Docker_Hub_arm64:
needs: cargo_version_bump
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: Bump patch version
run: |
# Get the current version
VERSION=$(grep -oP '^version = "\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: remove dev deps and version (for cache purposes)
run: |
sh .github/workflows/remove_dev_deps_and_version.sh
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-arm64
platforms: linux/arm64
cache-from: type=gha,scope=main-arm64
cache-to: type=gha,mode=max,scope=main-arm64
build-args: |
BUILDKIT_INLINE_CACHE=1
push_to_Docker_Hub_arm_v7:
needs: cargo_version_bump
runs-on: ubuntu-latest
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 10
- run: |
# Workaround for https://github.com/rust-lang/cargo/issues/8719
sudo mkdir -p /var/lib/docker
sudo mount -t tmpfs -o size=10G none /var/lib/docker
sudo systemctl restart docker
- name: checkout repo
uses: actions/checkout@v3
- name: get version
run: |
# Get the current version
VERSION=$(grep -oP '^version = "\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: remove dev deps and version (for cache purposes)
run: |
sh .github/workflows/remove_dev_deps_and_version.sh
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-armv7
platforms: linux/arm/v7
cache-from: type=gha,scope=main-armv7
cache-to: type=gha,mode=max,scope=main-armv7
build-args: |
BUILDKIT_INLINE_CACHE=1
merge_tags:
needs: [push_to_Docker_Hub_arm64, push_to_Docker_Hub_arm_v7, push_to_Docker_Hub_amd64]
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: get version
run: |
# Get the current version
VERSION=$(grep -oP '^version = "\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: merge into latest
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:latest ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-armv7 ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-arm64 ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-amd64
- name: merge into versio
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-armv7 ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-arm64 ${{ secrets.DOCKERHUB_USERNAME }}/vod2pod-rss:${{ env.VERSION }}-amd64