diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index 25f342fe..b5aa668c 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -25,33 +25,45 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: ✍🏼 version SambaNAs + - name: 📽️ Extract dev branch project name + shell: bash + run: echo "name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/devrelease/}}" >> $GITHUB_OUTPUT + id: extract_project + + - name: ✍🏼 version ${{ steps.extract_project.outputs.name }} + id: version_get + uses: endaft/action-yamler@v1.1.1 + with: + file: ./${{ steps.extract_project.outputs.name }}/config.yaml + path: version + get: true + + - name: 📽️ Identify SemVer ${{ steps.version_get.outputs.value_old }} suffix + shell: bash + run: echo "suffix=${{ contains(steps.version_get.outputs.value_old,'-') && '.' || '-' }}" >> $GITHUB_OUTPUT + id: semver-suffix + + - name: ✍🏼 version ${{ steps.extract_project.outputs.name }} id: version_set uses: endaft/action-yamler@v1.1.1 with: - file: ./sambanas/config.yaml + file: ./${{ steps.extract_project.outputs.name }}/config.yaml path: version - set: .dev${{ github.run_number }} + set: ${{ steps.semver-suffix.outputs.suffix }}dev${{ github.run_number }} get: true append: true - - - name: Publish SambaNAS Addon ${{ steps.version_set.outputs.value_old }} + - name: 📰 Publish ${{ steps.extract_project.outputs.name }} Addon ${{ steps.version_set.outputs.value_old }} uses: home-assistant/builder@master env: CAS_API_KEY: ${{ secrets.CAS_API_KEY }} with: args: | --aarch64 \ - --target sambanas \ + --target ${{ steps.extract_project.outputs.name }} \ --docker-hub dianlight - - name: Extract branch name - shell: bash - run: echo "BR_VERSION=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" - id: extract_branch - - - name: pull-request + - name: 🧑🏽‍💻 pull-request env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true @@ -59,8 +71,8 @@ jobs: run: | git config --global user.email "workflow-bot@github.com" git config --global user.name "Prerelease Bot" - git branch -f "prerelease/${{ steps.extract_branch.outputs.BR_VERSION }}_${{ steps.version_set.outputs.value_old }}" HEAD - git push -u origin "prerelease/${{ steps.extract_branch.outputs.BR_VERSION }}_${{ steps.version_set.outputs.value_old }}" || : + git branch -f "prerelease/${{ steps.extract_project.outputs.name }}_${{ steps.version_set.outputs.value_old }}" HEAD + git push -u origin "prerelease/${{ steps.extract_project.outputs.name }}_${{ steps.version_set.outputs.value_old }}" || : git restore . git clean -f - gh pr create --base "prerelease/${{ steps.extract_branch.outputs.BR_VERSION }}_${{ steps.version_set.outputs.value_old }}" --title "Releasing ${{ github.ref }} into prerelease" --body ":crown: *An automated PR*" + gh pr create --base "prerelease/${{ steps.extract_project.outputs.name }}_${{ steps.version_set.outputs.value_old }}" --title "Releasing ${{ github.ref }} into prerelease" --body ":crown: *An automated PR*" diff --git a/.github/workflows/docker-image-pre.yml b/.github/workflows/docker-image-pre.yml index 7f3a2a92..c35cf64c 100644 --- a/.github/workflows/docker-image-pre.yml +++ b/.github/workflows/docker-image-pre.yml @@ -24,34 +24,55 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: ✍🏼 version SambaNAs + - name: 📽️ Extract dev branch project name + shell: bash + run: | + FULL_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/devrelease/}}" + echo "full_name=${FULL_NAME} >> $GITHUB_OUTPUT + echo "name=${FULL_NAME%%_*}" >> $GITHUB_OUTPUT + id: extract_project + + - name: ✍🏼 version ${{ steps.extract_project.outputs.name }} + id: version_get + uses: endaft/action-yamler@v1.1.1 + with: + file: ./${{ steps.extract_project.outputs.name }}/config.yaml + path: version + get: true + + - name: 📽️ Identify SemVer ${{ steps.version_get.outputs.value_old }} suffix + shell: bash + run: echo "suffix=${{ contains(steps.version_get.outputs.value_old,'-') && '.' || '-' }}" >> $GITHUB_OUTPUT + id: semver-suffix + + - name: ✍🏼 version ${{ steps.extract_project.outputs.name }} id: version_set uses: endaft/action-yamler@v1.1.1 with: - file: ./sambanas/config.yaml + file: ./${{ steps.extract_project.outputs.name }}/config.yaml path: version - set: .beta${{ github.run_number }} + set: ${{ steps.semver-suffix.outputs.suffix }}beta${{ github.run_number }} get: true append: true - - name: ✍🏼 BetaName SambaNAs + - name: ✍🏼 BetaName ${{ steps.extract_project.outputs.name }} id: betaname_set uses: endaft/action-yamler@v1.1.1 with: - file: ./sambanas/config.yaml + file: ./${{ steps.extract_project.outputs.name }}/config.yaml path: name set: -β get: true append: true - - name: Publish SambaNAS Addon ${{ steps.version_set.outputs.value_new }} + - name: Publish ${{ steps.extract_project.outputs.name }} Addon ${{ steps.version_set.outputs.value_new }} uses: home-assistant/builder@master env: CAS_API_KEY: ${{ secrets.CAS_API_KEY }} with: args: | --all \ - --target sambanas \ + --target ${{ steps.extract_project.outputs.name }} \ --docker-hub dianlight - name: Create pull request for Beta Repository @@ -63,7 +84,7 @@ jobs: git_config_user_email: 'ffp-bot@github.com' git_config_user_name: 'ffp-bot' target_repo: 'dianlight/hassio-addons-beta' - source_dir: 'sambanas' + source_dir: '${{ steps.extract_project.outputs.name }}' # source_dir_copy_glob: '!(*.yaml)' target_dir: '' pr_target_repo_base_branch: 'master' diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 09a6f275..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Docker Image CI - Build Release. - -on: - push: - branches: - - release/* - workflow_dispatch: - -permissions: - pull-requests: write - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # - name: Publish Plex Addon - # uses: home-assistant/builder@master - # with: - # args: | - # --all \ - # --docker-hub-check \ - # --target addon-plex/plex \ - # --docker-hub dianlight - - - name: Publish SambaNAS Addon - uses: home-assistant/builder@master - env: - CAS_API_KEY: ${{ secrets.CAS_API_KEY }} - with: - args: | - --all \ - --docker-hub-check \ - --target sambanas \ - --docker-hub dianlight - - - name: pull-request - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true - shell: bash - run: | - gh pr create --title "Releasing ${{ github.ref }} into master" --body ":crown: *An automated PR*" diff --git a/.github/workflows/rebuild.yml b/.github/workflows/rebuild.yml index 0c253621..c70b3bbd 100644 --- a/.github/workflows/rebuild.yml +++ b/.github/workflows/rebuild.yml @@ -1,4 +1,4 @@ -name: Rebuild Docker Image CI +name: Rebuild Docker Image CI - Emergency Rebuild All on: workflow_dispatch: @@ -27,3 +27,13 @@ jobs: --all \ --target sambanas \ --docker-hub dianlight + + - name: Publish BeSIM Addon + uses: home-assistant/builder@master + env: + CAS_API_KEY: ${{ secrets.CAS_API_KEY }} + with: + args: | + --all \ + --target besim \ + --docker-hub dianlight