diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..f0ec87b --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,58 @@ +name: docker-build + +on: + schedule: + - cron: "0 10 * * *" + push: + branches: + - "**" + tags: + - "v*.*.*" + pull_request: + branches: + - "main" + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + geokrety/basex-amqp-sync + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push - base + uses: docker/build-push-action@v4 + with: + file: Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..20e587b --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,18 @@ +name: pre-commit + +on: + pull_request: + push: + branches: + - '*' + +jobs: + + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + + - uses: pre-commit/action@v3 diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml new file mode 100644 index 0000000..7af8c7f --- /dev/null +++ b/.github/workflows/semantic-release.yml @@ -0,0 +1,123 @@ +name: Semantic release + +on: + push: + branches: + - main + +jobs: + release: + if: "!contains(github.event.head_commit.message, 'skip ci')" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ssh-key: "${{ secrets.COMMIT_KEY }}" + + # setting up Node + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + # disable package-lock.json to stop it being created + - name: Disable package-lock.json + run: npm config set package-lock false + + # Installing package dependencies + - name: Install dependencies + run: | + npm i -D js-yaml@4.1.0 conventional-changelog-conventionalcommits semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/exec @semantic-release/changelog @semantic-release/github @semantic-release/git + + - name: New tag + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GIT_AUTHOR_NAME: geokrety-bot + GIT_AUTHOR_EMAIL: geokrety-bot@users.noreply.github.com + GIT_COMMITTER_NAME: geokrety-bot + GIT_COMMITTER_EMAIL: geokrety-bot@users.noreply.github.com + run: | + cat > .releaserc.json <