From e161b4949b20aa18cf3ee882ed836f939896c01b Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Dec 2023 06:51:57 +0000 Subject: [PATCH 1/5] Add test.yml --- test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test.yml diff --git a/test.yml b/test.yml new file mode 100644 index 0000000..637f42a --- /dev/null +++ b/test.yml @@ -0,0 +1,16 @@ +name: 'Run Tests on Code' +author: 'Neshura' + +on: + push: + tags-ignore: + - '**' + branches: + - '**' +jobs: + run-tests: + runs-on: docker + steps: + - + name: Placeholder + run: echo Placeholder Job \ No newline at end of file From 614c0d6f8da7bc2813e174fb279e087b2f5f6572 Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Dec 2023 06:53:44 +0000 Subject: [PATCH 2/5] Move test.yml to correct directory --- .forgejo/workflows/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .forgejo/workflows/test.yml diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..637f42a --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,16 @@ +name: 'Run Tests on Code' +author: 'Neshura' + +on: + push: + tags-ignore: + - '**' + branches: + - '**' +jobs: + run-tests: + runs-on: docker + steps: + - + name: Placeholder + run: echo Placeholder Job \ No newline at end of file From 36243e61370fc18eb2b03b4c1b5923a43667ce5d Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Dec 2023 06:54:02 +0000 Subject: [PATCH 3/5] Delete test.yml in wrong directory --- test.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 test.yml diff --git a/test.yml b/test.yml deleted file mode 100644 index 637f42a..0000000 --- a/test.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Run Tests on Code' -author: 'Neshura' - -on: - push: - tags-ignore: - - '**' - branches: - - '**' -jobs: - run-tests: - runs-on: docker - steps: - - - name: Placeholder - run: echo Placeholder Job \ No newline at end of file From e0350d04defb9d09ad7bcd8bc703a61a0827209f Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Dec 2023 07:03:16 +0000 Subject: [PATCH 4/5] Add build Action --- .forgejo/workflows/build+release.yml | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .forgejo/workflows/build+release.yml diff --git a/.forgejo/workflows/build+release.yml b/.forgejo/workflows/build+release.yml new file mode 100644 index 0000000..cc0a137 --- /dev/null +++ b/.forgejo/workflows/build+release.yml @@ -0,0 +1,72 @@ +name: 'Build and Release Binary File' +author: 'Neshura' + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+rc[0-9]+' +jobs: + run-tests: + runs-on: docker + steps: + - + name: Placeholder + run: echo Placeholder Job + + build: + needs: test + if: success() + runs-on: docker + container: rust:latest + steps: + - + name: Installing Node + run: apt update && apt install -y nodejs + - + name: Checking Out Repository Code + uses: https://code.forgejo.org/actions/checkout@v3 + - + name: Compiling To Linux Target + run: | + cargo build -r + mv target/release/cloudflare-dns-updater cloudflare-dns-updater-linux-amd64 + - + name: Uploading Build Artifact + uses: actions/upload-artifact@v3 + with: + name: cloudflare-dns-updater-linux-amd64 + path: cloudflare-dns-updater-linux-amd64 + if-no-files-found: error + + upload-release: + needs: build + if: success() + runs-on: docker + steps: + - + name: Downloading All Build Artifacts + uses: actions/download-artifact@v3 + - + name: Rearrange Artifact Paths + run: | + mkdir release + mv cloudflare-dns-updater-linux-amd64/cloudflare-dns-updater-linux-amd64 release/cloudflare-dns-updater-linux-amd64 + - + name: Upload Artifacts As Generic Packages + run: | + echo 'curl -v --user ${{ secrets.FORGEJO_USERNAME }}:${{ secrets.FORGEJO_TOKEN }} \ + --upload-file release/cloudflare-dns-updater-linux-amd64 \ + https://forgejo.neshweb.net/api/packages/${{ secrets.FORGEJO_USERNAME }}/generic/${{ github.event.repository.name }}/${{ github.ref_name }}/chellaris-rust-api-linux-amd64' + curl -v --user ${{ secrets.FORGEJO_USERNAME }}:${{ secrets.FORGEJO_TOKEN }} \ + --upload-file release/cloudflare-dns-updater-linux-amd64 \ + https://forgejo.neshweb.net/api/packages/${{ secrets.FORGEJO_USERNAME }}/generic/${{ github.event.repository.name }}/${{ github.ref_name }}/chellaris-rust-api-linux-amd64 + - + name: Release New Version + uses: actions/forgejo-release@v1 + with: + direction: upload + url: https://forgejo.neshweb.net + release-dir: release + token: ${{ secrets.FORGEJO_TOKEN }} + tag: ${{ github.ref_name }} \ No newline at end of file From 5818e5d4ab624f0d410092354d93952fcf2bee72 Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Dec 2023 07:03:37 +0000 Subject: [PATCH 5/5] Delete .gitlab-ci.yml --- .gitlab-ci.yml | 71 -------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 199f4bc..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -image: 3.10.8-slim-buster - -variables: - PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux/$CI_COMMIT_TAG/" - -.deploy: - rules: - # Regex magic copied from Neshura/page-test, only deploys on x.y.z or higher (x.y) Tags - - if: $CI_COMMIT_TAG =~ /^((([\d])+\.){1,2}[\d]+)\s*$/ && $CI_COMMIT_TAG - -stages: - - build - - upload - - release - -## Docker steps - -build: - image: rust:bullseye - stage: build - - variables: - IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH - CACHING: - - script: - - echo "Compiling the code..." - - cargo build -r - - echo "Compile complete." - - after_script: - - echo JOB_ID=$CI_JOB_ID >> job.env - - mkdir ./artifacts - - cp /builds/Neshura/cloudflare-dns-updater/target/release/cloudflare-dns-updater ./artifacts/ - - artifacts: - paths: - - ./artifacts/ - reports: - dotenv: job.env - - rules: - - !reference [.deploy, rules] - -upload: - needs: - - job: build - artifacts: true - image: curlimages/curl:latest - stage: upload - script: - - | - curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/cloudflare-dns-updater "${PACKAGE_REGISTRY_URL}/cloudflare-dns-updater" - rules: - - !reference [.deploy, rules] - -Tag Release: - stage: release - image: registry.gitlab.com/gitlab-org/release-cli:latest - rules: - - !reference [.deploy, rules] - script: - - echo "running Release Job, attaching Artifact from Job $JOB_ID" - release: - tag_name: '$CI_COMMIT_TAG' - description: '$CI_COMMIT_TAG' - assets: - links: - - name: "cloudflare-dns-updater" - url: "${PACKAGE_REGISTRY_URL}/cloudflare-dns-updater" - \ No newline at end of file