From 4cb696f7f5fd2c35762947520b7cae470230035d Mon Sep 17 00:00:00 2001 From: Fjodor van Rijsselberg Date: Wed, 14 Dec 2022 14:58:40 +0100 Subject: [PATCH] Added job for pushing image to dockerhub repo. --- .github/workflows/docker-image.yml | 66 ++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..6223e72 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,66 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + # + # test: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # python-version: ["3.9.14"] + # name: Run tests + # steps: + # - name: Checkout repo + # uses: actions/checkout@v3 + # - name: Set python version + # uses: actions/setup-python@v4 + # with: + # python-version: '3.9.14' + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install pytest + # pip install poetry + # poetry config virtualenvs.create false + # poetry install + # - name: Perform gruesome hack + # run: | + # cp -r pyproject.toml src/stub.toml + # cp -r pyproject.toml src/tests/stub.toml + # - name: Run Pytest + # run: | + # cd src/ + # pytest + push: + name: Push to registry. + runs-on: ubuntu-latest + # needs: test + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set python version + uses: actions/setup-python@v4 + with: + python-version: '3.9.14' + - name: Perform gruesome hack + run: | + cp -r pyproject.toml src/stub.toml + - name: Get version and tag image + run: | + pip install tomli + cd src/ + echo "version=`python version.py`" >> $GITHUB_ENV + - name: Login to registry + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_PASSWORD }} + - name: Push to dockerhub + run: | + docker build . --file Dockerfile --tag fjodorvr/dataverse-metadata-fetcher:${{ env.version }} + docker push fjodorvr/dataverse-metadata-fetcher:${{ env.version }}