Merge pull request #130 from madiele/main #72
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: 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@v4 | |
- 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 "[email protected]" | |
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@v4 | |
- 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 stable | |
shell: bash | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
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@v4 | |
- 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 stable | |
shell: bash | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
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/[email protected] | |
with: | |
swap-size-gb: 10 | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- 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 stable | |
shell: bash | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
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@v4 | |
- 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@v3 | |
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 |