diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..afd821d --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -0,0 +1,79 @@ +--- +name: Build and publish Debian package +on: [create] +jobs: + build: + runs-on: docker + container: + image: docker.io/brenard/debian-python-deb:latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build Debian package + env: + MAINTAINER_NAME: ${{ vars.MAINTAINER_NAME }} + MAINTAINER_EMAIL: ${{ vars.MAINTAINER_EMAIL }} + DEBIAN_CODENAME: ${{ vars.DEBIAN_CODENAME }} + run: | + echo "${{ secrets.GPG_KEY }}"|base64 -d|gpg --import + ./build.sh + - name: Upload Debian package files + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + dist + + publish-forgejo: + runs-on: docker + container: + image: docker.io/brenard/debian-python-deb:latest + steps: + - name: Download Debian package files + uses: actions/download-artifact@v3 + with: + name: dist + + - name: Create the release + id: create-release + shell: bash + run: | + mkdir release + mv *.deb release/ + mv check-forgejo-upgrade-*/check_forgejo_upgrade release/ + { + echo 'release_note<> "$GITHUB_OUTPUT" + + - name: Publish release on Forgejo + uses: actions/forgejo-release@v1 + with: + direction: upload + url: https://gitea.zionetrix.net + token: ${{ secrets.forgejo_token }} + release-dir: release + release-notes: ${{ steps.create-release.outputs.release_note }} + + publish-aptly: + runs-on: docker + container: + image: docker.io/brenard/aptly-publish:latest + steps: + - name: "Download Debian package files" + uses: actions/download-artifact@v3 + with: + name: dist + + - name: "Publish Debian package on Aptly repository" + uses: https://gitea.zionetrix.net/bn8/aptly-publish@master + with: + api_url: ${{ vars.apt_api_url }} + api_username: ${{ vars.apt_api_username }} + api_password: ${{ secrets.apt_api_password }} + repo_name: ${{ vars.apt_repo_name }} + path: "./" + source_name: ${{ vars.apt_source_name }} diff --git a/.forgejo/workflows/tests.yaml b/.forgejo/workflows/tests.yaml new file mode 100644 index 0000000..6f91ddf --- /dev/null +++ b/.forgejo/workflows/tests.yaml @@ -0,0 +1,21 @@ +--- +name: Run tests +on: [push] +jobs: + test-precommit: + runs-on: docker + container: + image: docker.io/brenard/python-pre-commit:latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install python dependencies + env: + DEBIAN_FRONTEND: noninteractive + run: | + apt-get update + apt-get -y install --no-install-recommends python3-requests python3-xmltodict + - name: Run pre-commit + run: pre-commit run --all-files diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index d48b55a..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,64 +0,0 @@ -clone: - git: - image: woodpeckerci/plugin-git - tags: true - -steps: - tests: - image: brenard/python-pre-commit:latest - commands: - - DEBIAN_FRONTEND=noninteractive apt-get -qq update < /dev/null > /dev/null - - DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends python3-requests python3-xmltodict < /dev/null > /dev/null - - pre-commit run --all-files - - build: - image: brenard/debian-python-deb - when: - event: tag - depends_on: [tests] - commands: - - echo "$GPG_KEY"|base64 -d|gpg --import - - ./build.sh --quiet - secrets: [maintainer_name, maintainer_email, gpg_key, debian_codename] - - publish-dryrun: - image: alpine - when: - event: tag - depends_on: [build] - commands: - - ls dist/* dist/check-forgejo-upgrade-*/check_forgejo_upgrade - - publish-gitea: - image: plugins/gitea-release - when: - event: tag - depends_on: [build] - settings: - api_key: - from_secret: gitea_token - base_url: https://gitea.zionetrix.net - note: dist/release_notes.md - files: - - dist/check-forgejo-upgrade-*/check_forgejo_upgrade - - dist/*.deb - checksum: - - md5 - - sha512 - - publish-apt: - image: brenard/aptly-publish - when: - event: tag - depends_on: [build] - settings: - api_url: - from_secret: apt_api_url - api_username: - from_secret: apt_api_username - api_password: - from_secret: apt_api_password - repo_name: - from_secret: apt_repo_name - path: dist - source_name: check-forgejo-upgrade