From 4f34b6bc78a7ef08b2794cf1dedd2c51a0ee9bbd Mon Sep 17 00:00:00 2001 From: Hamed Karbasi Date: Sat, 17 Feb 2024 20:52:26 +0330 Subject: [PATCH] add github workflows --- .github/release.yaml | 18 ++++++++++++++ .github/workflows/ci.yml | 30 +++++++++++++++++++++++ .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/release.yaml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000..ddc7659 --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,18 @@ +# .github/release.yml + +changelog: + categories: + - title: Bug Fixes 🐛 + labels: + - bug + - title: Breaking Changes 🛠 + labels: + - Semver-Major + - breaking-change + - title: Exciting New Features 🎉 + labels: + - Semver-Minor + - enhancement + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2a85ff9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tests + run: pytest -v \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eb1c7a9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" # Run workflow on version tags, e.g. v1.0.0. + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v4 + id: meta + with: + images: ghcr.io/${{ github.repository }} + + - uses: docker/build-push-action@v4 + with: + file: "Dockerfile" + context: . + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + release: + needs: build-and-push + name: release + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + - name: release + run: gh release create ${{ github.ref_name }} --generate-notes --verify-tag