diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 6c127ad..0000000 --- a/.drone.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Drone CI File! - -kind: pipeline -type: kubernetes -name: default - -metadata: - namespace: builds - -node_selector: - doks.digitalocean.com/node-pool: josa-cloud-np - -steps: - - name: build - image: plugins/docker - settings: - repo: josaorg/nuha-api - tags: - - ${DRONE_COMMIT_SHA} - - latest - username: - from_secret: docker_username - password: - from_secret: docker_password - - name: notify - image: plugins/slack - settings: - webhook: - from_secret: slack_webhook - channel: heartbeat - depends_on: - - build diff --git a/.github/workflows/schedule-milestones.yaml b/.github/workflows/schedule-milestones.yaml new file mode 100644 index 0000000..35a319d --- /dev/null +++ b/.github/workflows/schedule-milestones.yaml @@ -0,0 +1,24 @@ +name: schedule-milestones + +on: + schedule: + - cron: 0 0 * * SUN # Run every Sunday at midnight + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Schedule Milestones + uses: readmeio/scheduled-milestones@v1.1.1 + id: scheduled + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: 'S-' + days: Thursday + count: 4 + format: YYYY-MM-DD + + - name: Created Milestones + run: echo ${{ steps.scheduled.outputs.milestones }} diff --git a/.woodpecker/build-latest-image.yaml b/.woodpecker/build-latest-image.yaml new file mode 100644 index 0000000..5829800 --- /dev/null +++ b/.woodpecker/build-latest-image.yaml @@ -0,0 +1,96 @@ +when: + - event: [push, manual] + branch: + exclude: [main] + - event: [pull_request] + # Only run when PR targets development or other branches (not main) + evaluate: 'CI_COMMIT_TARGET_BRANCH != "main"' + +variables: + - &docker_repo "josaorg/nuha-api" + - &slack_channel "builds" + # Success message template + - &success_message > + ✅ *SUCCESS* - Latest Build #{{ build.number }} + + 📁 *Repository:* {{ repo.name }} + 🌿 *Branch:* {{ build.branch }} + 📝 *Commit:* {{ truncate build.commit 8 }} + 👤 *Author:* {{ build.author }} + + 🔗 *Links:* + • <{{ build.link }}|View Build> + # Failure message template + - &failure_message > + ❌ *FAILED* - Latest Build #{{ build.number }} + + 📁 *Repository:* {{ repo.name }} + 🌿 *Branch:* {{ build.branch }} + 📝 *Commit:* {{ truncate build.commit 8 }} + 👤 *Author:* {{ build.author }} + + 🔗 *Links:* + • <{{ build.link }}|View Build> + +steps: + # Security check - scan for secrets/credentials + - name: run-pre-commit-hooks + image: josaorg/pre-commit-runner + settings: + args: "--all-files" + skip: "end-of-file-fixer, yamllint" + + # Build latest image (development and other branches) + - name: build-latest-image + image: woodpeckerci/plugin-docker-buildx + settings: + repo: *docker_repo + dockerfile: ./Dockerfile + tags: + - ${CI_COMMIT_SHA:-latest} + - latest + username: + from_secret: DOCKER_HUB_USERNAME + password: + from_secret: DOCKER_HUB_PASSWORD + build_args: + CI_REPO: "${CI_REPO}" + CI_REPO_NAME: "${CI_REPO_NAME}" + CI_REPO_URL: "${CI_REPO_URL}" + CI_COMMIT_SHA: "${CI_COMMIT_SHA}" + CI_COMMIT_REF: "${CI_COMMIT_REF}" + CI_PIPELINE_URL: "${CI_PIPELINE_URL}" + CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}" + CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}" + CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}" + + depends_on: + - run-pre-commit-hooks + + # Slack notification for latest build success + - name: notify-slack-latest-success + image: plugins/slack + settings: + webhook: + from_secret: SLACK_WEBHOOK + channel: *slack_channel + template: *success_message + when: + - status: success + depends_on: + - run-pre-commit-hooks + - build-latest-image + + # Slack notification for latest build failure + - name: notify-slack-latest-failure + image: plugins/slack + settings: + webhook: + from_secret: SLACK_WEBHOOK + channel: *slack_channel + template: *failure_message + when: + - status: failure + depends_on: + - run-pre-commit-hooks + - build-latest-image diff --git a/.woodpecker/build-stable-image.yaml b/.woodpecker/build-stable-image.yaml new file mode 100644 index 0000000..50bd960 --- /dev/null +++ b/.woodpecker/build-stable-image.yaml @@ -0,0 +1,96 @@ +when: + - event: [push, manual] + branch: [main] + - event: [pull_request] + # Only run when PR targets main branch + evaluate: 'CI_COMMIT_TARGET_BRANCH == "main"' + # Build the source branch (not main) + branch: + exclude: [main] + +variables: + - &docker_repo "josaorg/nuha-api" + - &slack_channel "builds" + # Success message template + - &success_message > + ✅ *SUCCESS* - Stable Build #{{ build.number }} + + 📁 *Repository:* {{ repo.name }} + 🌿 *Branch:* {{ build.branch }} + 📝 *Commit:* {{ truncate build.commit 8 }} + 👤 *Author:* {{ build.author }} + + 🔗 *Links:* + • <{{ build.link }}|View Build> + # Failure message template + - &failure_message > + ❌ *FAILED* - Stable Build #{{ build.number }} + + 📁 *Repository:* {{ repo.name }} + 🌿 *Branch:* {{ build.branch }} + 📝 *Commit:* {{ truncate build.commit 8 }} + 👤 *Author:* {{ build.author }} + + 🔗 *Links:* + • <{{ build.link }}|View Build> + +steps: + - name: run-pre-commit-hooks + image: josaorg/pre-commit-runner + settings: + args: "--all-files" + skip: "end-of-file-fixer, yamllint" + + # Build stable image (main branch only) + - name: build-stable-image + image: woodpeckerci/plugin-docker-buildx + settings: + repo: *docker_repo + dockerfile: ./Dockerfile + tags: + - ${CI_COMMIT_SHA:-latest} + - stable + username: + from_secret: DOCKER_HUB_USERNAME + password: + from_secret: DOCKER_HUB_PASSWORD + build_args: + CI_REPO: "${CI_REPO}" + CI_REPO_NAME: "${CI_REPO_NAME}" + CI_REPO_URL: "${CI_REPO_URL}" + CI_COMMIT_SHA: "${CI_COMMIT_SHA}" + CI_COMMIT_REF: "${CI_COMMIT_REF}" + CI_PIPELINE_URL: "${CI_PIPELINE_URL}" + CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}" + CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}" + CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}" + depends_on: + - run-pre-commit-hooks + + # Slack notification for stable build success + - name: notify-slack-stable-success + image: plugins/slack + settings: + webhook: + from_secret: SLACK_WEBHOOK + channel: *slack_channel + template: *success_message + when: + - status: success + depends_on: + - run-pre-commit-hooks + - build-stable-image + + # Slack notification for stable build failure + - name: notify-slack-stable-failure + image: plugins/slack + settings: + webhook: + from_secret: SLACK_WEBHOOK + channel: *slack_channel + template: *failure_message + when: + - status: failure + depends_on: + - run-pre-commit-hooks + - build-stable-image