diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..bc829442 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,129 @@ +name: Build Docker Container + +on: push + +jobs: + build-container: + name: Build ${{ matrix.name }} Container + runs-on: ubuntu-latest + if: github.repository_owner == 'TandoorRecipes' + continue-on-error: ${{ matrix.continue-on-error }} + permissions: + contents: read + packages: write + strategy: + matrix: + include: + # Standard build config + - name: Standard + dockerfile: Dockerfile + platforms: linux/amd64,linux/arm64 + suffix: "" + continue-on-error: false + # Raspi build config + - name: Raspi + dockerfile: Dockerfile-raspi + platforms: linux/arm/v7 + suffix: "-raspi" + continue-on-error: true + steps: + - uses: actions/checkout@v3 + + - name: Get version number + id: get_version + run: | + if [[ "$GITHUB_REF" = refs/tags/* ]]; then + echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + elif [[ "$GITHUB_REF" = refs/heads/beta ]]; then + echo VERSION=beta >> $GITHUB_OUTPUT + else + echo VERSION=develop >> $GITHUB_OUTPUT + fi + + # Update Version number + - name: Update version file + uses: DamianReeves/write-file-action@v1.2 + with: + path: recipes/version.py + contents: | + VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' + BUILD_REF = '${{ github.sha }}' + write-mode: overwrite + + # Build Vue frontend + - uses: actions/setup-node@v3 + with: + node-version: '14' + cache: yarn + cache-dependency-path: vue/yarn.lock + - name: Install dependencies + working-directory: ./vue + run: yarn install --frozen-lockfile + - name: Build dependencies + working-directory: ./vue + run: yarn build + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + vabene1111/recipes + flavor: | + latest=false + suffix=${{ matrix.suffix }} + tags: | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=ref,event=branch + - name: Build and Push + uses: docker/build-push-action@v4 + with: + context: . + file: ${{ matrix.dockerfile }} + pull: true + push: true + platforms: ${{ matrix.platforms }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + notify-stable: + name: Notify Stable + runs-on: ubuntu-latest + needs: build-container + if: startsWith(github.ref, 'refs/tags/') + steps: + # Send stable discord notification + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: '🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of tandoor has been released 🥳 Check it out https://github.com/vabene1111/recipes/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}' + + notify-beta: + name: Notify Beta + runs-on: ubuntu-latest + needs: build-container + if: github.ref == 'refs/heads/beta' + steps: + # Send beta discord notification + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_BETA_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: '🚀 The BETA Image has been updated! 🥳' diff --git a/.github/workflows/docker-publish-beta-raspi.yml b/.github/workflows/docker-publish-beta-raspi.yml deleted file mode 100644 index d3e382f5..00000000 --- a/.github/workflows/docker-publish-beta-raspi.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: publish beta raspi image docker -on: - push: - branches: - - 'beta' -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = 'beta' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - tag: beta-raspi - dockerFile: Dockerfile-raspi - platform: linux/arm/v7 - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} - # Send discord notification - - name: Discord notification - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_BETA_WEBHOOK }} - uses: Ilshidur/action-discord@0.3.2 - with: - args: '🚀 The BETA Image has been updated! 🥳' \ No newline at end of file diff --git a/.github/workflows/docker-publish-beta.yml b/.github/workflows/docker-publish-beta.yml deleted file mode 100644 index 715507f6..00000000 --- a/.github/workflows/docker-publish-beta.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: publish beta image docker -on: - push: - branches: - - 'beta' -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = 'beta' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - tag: beta - platform: linux/amd64,linux/arm64 - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} - # Send discord notification - - name: Discord notification - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_BETA_WEBHOOK }} - uses: Ilshidur/action-discord@0.3.2 - with: - args: '🚀 The BETA Image has been updated! 🥳' \ No newline at end of file diff --git a/.github/workflows/docker-publish-dev.yml b/.github/workflows/docker-publish-dev.yml deleted file mode 100644 index 59db59de..00000000 --- a/.github/workflows/docker-publish-dev.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: publish dev image docker -on: - push: - branches: - - '*' - - '*/*' - - '!master' -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = 'develop' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Clear Cache - working-directory: ./vue - run: yarn cache clean --all - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@2.13 - with: - name: vabene1111/recipes - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-latest-raspi.yml b/.github/workflows/docker-publish-latest-raspi.yml deleted file mode 100644 index 8907e2c9..00000000 --- a/.github/workflows/docker-publish-latest-raspi.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: publish latest raspi image docker -on: - push: - tags: - - '*' - -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Get version number - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}-raspi - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}-raspi' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - dockerFile: Dockerfile-raspi - platform: linux/arm/v7 - tag: latest-raspi - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-latest.yml b/.github/workflows/docker-publish-latest.yml deleted file mode 100644 index e48bb307..00000000 --- a/.github/workflows/docker-publish-latest.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: publish latest image docker -on: - push: - tags: - - '*' - -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Get version number - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - platform: linux/amd64,linux/arm64 - tag: latest - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-release-raspi.yml b/.github/workflows/docker-publish-release-raspi.yml deleted file mode 100644 index 76da44a1..00000000 --- a/.github/workflows/docker-publish-release-raspi.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: publish tagged raspi release docker - -on: - release: - types: [published] - -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - name: Build image job - steps: - - name: Checkout master - uses: actions/checkout@master - - name: Get version number - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - dockerFile: Dockerfile-raspi - platform: linux/arm/v7 - tag: ${{ steps.get_version.outputs.VERSION }}-raspi - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-release.yml b/.github/workflows/docker-publish-release.yml deleted file mode 100644 index 1b79b34d..00000000 --- a/.github/workflows/docker-publish-release.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: publish tagged release docker - -on: - release: - types: [published] - -jobs: - build: - if: github.repository_owner == 'TandoorRecipes' - runs-on: ubuntu-latest - name: Build image job - steps: - - name: Checkout master - uses: actions/checkout@master - - name: Get version number - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.0 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install dependencies - working-directory: ./vue - run: yarn install - - name: Build dependencies - working-directory: ./vue - run: yarn build - # Build container - - name: Build and publish image - uses: ilteoood/docker_buildx@master - with: - publish: true - imageName: vabene1111/recipes - platform: linux/amd64,linux/arm64 - tag: ${{ steps.get_version.outputs.VERSION }} - dockerUser: ${{ secrets.DOCKER_USERNAME }} - dockerPassword: ${{ secrets.DOCKER_PASSWORD }} - # Send discord notification - - name: Discord notification - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} - uses: Ilshidur/action-discord@0.3.2 - with: - args: '🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of tandoor has been released 🥳 Check it out https://github.com/vabene1111/recipes/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}'