diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7370be2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,55 @@ +name: build + +on: + push: + branches: + - main + +jobs: + release: + runs-on: docker + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Define next tag + uses: https://github.com/paulhatch/semantic-version@v5.0.2 + id: version + with: + tag_prefix: "" + major_pattern: "(MAJOR)" + minor_pattern: "(MINOR)" + change_path: . + version_format: "${major}.${minor}.${patch}" + + - name: Create tag + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + + git tag "${{ steps.version.outputs.version }}" -m "[forgejo-action-tag]" + git push origin --tags + docker: + runs-on: host + needs: + - release + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: git.h2-invent.com + username: ${{ secrets.FORGEJO_ACTION_PACKAGE_RW_USER }} + password: ${{ secrets.FORGEJO_ACTION_PACKAGE_RW_KEY }} + + - name: Build and push Image + uses: docker/build-push-action@v6 + with: + push: true + tags: git.h2-invent.com/meetling/matrix-bot:${{ needs.release.outputs.version }} \ No newline at end of file diff --git a/.github/workflows/pipeline-release.yml b/.github/workflows/pipeline-release.yml deleted file mode 100644 index fc07560..0000000 --- a/.github/workflows/pipeline-release.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Create Release - -env: - GITHUB_TOKEN: ${{ secrets.token }} - -on: - push: - branches: - - main - - master - -jobs: - artifact: - uses: h2-invent/jitsi-admin-matrix-bot/.github/workflows/task-artifact.yml@master - - create_release: - needs: - - artifact - runs-on: ubuntu-latest - outputs: - create_release_output: ${{ steps.version.outputs.version }} - steps: - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: paulhatch/semantic-version@v5.0.2 - id: version - with: - tag_prefix: "" - major_pattern: "(MAJOR)" - minor_pattern: "(MINOR)" - change_path: . - version_format: "${major}.${minor}.${patch}" - - - name: Write semantic Version in config file - uses: jacobtomlinson/gha-find-replace@v3 - with: - find: "" - replace: "${{ steps.version.outputs.version }}" - regex: false - - - uses: actions/download-artifact@v3 - with: - name: artifact_${{github.run_number}} - - - run: unzip -qq artifact_${{github.run_number}}.zip -d artifact - - - name: Write semantic Version in config file - uses: jacobtomlinson/gha-find-replace@v3 - with: - find: "" - replace: "${{ steps.version.outputs.version }}" - regex: false - include: "artifact/config.mjs" - - - - - name: Archive Release for application - uses: thedoctor0/zip-release@0.7.1 - with: - type: 'zip' - filename: 'application.zip' - exclusions: '*.git* *.github*' - directory: artifact - - - name: Create new Release with semantic-version tag - uses: ncipollo/release-action@v1 - id: create_release - with: - draft: false - prerelease: false - name: Release ${{ steps.version.outputs.version }} - tag: ${{ steps.version.outputs.version }} - artifacts: artifact/application.zip - artifactContentType: application/zip - bodyFile: RELEASE_NOTE.md - - upload_dockerhub_main: - needs: - - create_release - uses: h2-invent/jitsi-admin-matrix-bot/.github/workflows/task-upload-docker-hub.yml@master - with: - reponame: 'h2invent/jitsi-admin-matrix-bot' - dockerfile_path: './Dockerfile' - directory: '.' - version: h2invent/jitsi-admin-matrix-bot:latest,h2invent/jitsi-admin-matrix-bot:${{ needs.create_release.outputs.create_release_output }} - secrets: - dockerhub_password: ${{ secrets.DOCKERHUB_TOKEN }} - dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}