diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2010d23 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.idea +.mypy* +.vscode +venv \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e69633d..6126d20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,59 @@ -name: Publish Docker image +name: Publish release on: push: tags: - - '*' + - '[0-9]+.[0-9]+.[0-9]+' env: MM_NOTIFICATION_CHANNEL: 'bso-bot' jobs: - build: + publish-ghcr: + name: Docker image runs-on: ubuntu-latest steps: - name: 🏁 Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: 🏷️ Get Tag - id: version - run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: 🔑 Login docker + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - name: 🐋 Build docker image run: make docker-build - - name: 🔑 Login docker - run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} - - name: 📦 Push docker image run: make docker-push + release: + name: Release new version + runs-on: ubuntu-latest + needs: publish-ghcr + steps: + - name: 🏁 Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 🏷️ Get tag + id: tag + run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: 📦 Create release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.tag }} + name: ${{ steps.tag.outputs.tag }} + notify: - needs: build + needs: release if: always() runs-on: ubuntu-latest steps: - - uses: dataesr/mm-notifier-action@v1 + - uses: dataesr/mm-notifier-action@v1.1 with: - github_token: ${{ secrets.GITHUB_TOKEN}} - mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} - mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL}} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL }} + mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f43f52..2010d23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea -venv .mypy* +.vscode +venv \ No newline at end of file diff --git a/Makefile b/Makefile index de22696..bb5b65a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DOCKER_IMAGE_NAME=dataesr/harvest-pubmed +DOCKER_IMAGE_NAME=ghcr.io/dataesr/harvest-pubmed CURRENT_VERSION=$(shell cat pubmed/__init__.py | cut -d "'" -f 2) docker-build: @@ -8,8 +8,7 @@ docker-build: docker-push: @echo Pushing a new docker image - docker push $(DOCKER_IMAGE_NAME):$(CURRENT_VERSION) - docker push $(DOCKER_IMAGE_NAME):latest + docker push -a $(DOCKER_IMAGE_NAME) @echo Docker image pushed install: diff --git a/README.md b/README.md index bed2c7a..d2ca0ee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # harvest-pubmed +![GitHub](https://img.shields.io/github/license/dataesr/harvest-pubmed) +![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/dataesr/harvest-pubmed) ![Build](https://github.com/dataesr/harvest-pubmed/actions/workflows/build.yml/badge.svg) ## Release