diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 5fb2186..878c6aa 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -1,18 +1,13 @@ -name: Development build and push +name: Dev images to docker -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the main branch push: branches: [ development ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - - build-and-push: + dev-images-to-docker: runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it @@ -25,10 +20,6 @@ jobs: sed "s~{{GITHUB_REPOSITORY}}~$GITHUB_REPOSITORY~g; s/{{VERSION_LABEL}}/dev/g; s/{{GITHUB_REF_TYPE}}/$GITHUB_REF_TYPE/g; s/{{GITHUB_REF_NAME}}/$GITHUB_REF_NAME/g; s/{{GITHUB_SHA}}/$GITHUB_SHA/g; s/{{GITHUB_WORKFLOW}}/$GITHUB_WORKFLOW/g; s/{{GITHUB_RUN_NUMBER}}/$GITHUB_RUN_NUMBER/g; s/{{BUILD_DATE}}/$(date)/g" version.yml.template > server/src/main/resources/version.yml sed "s~{{GITHUB_REPOSITORY}}~$GITHUB_REPOSITORY~g; s/{{VERSION_LABEL}}/dev/g; s/{{GITHUB_REF_TYPE}}/$GITHUB_REF_TYPE/g; s/{{GITHUB_REF_NAME}}/$GITHUB_REF_NAME/g; s/{{GITHUB_SHA}}/$GITHUB_SHA/g; s/{{GITHUB_WORKFLOW}}/$GITHUB_WORKFLOW/g; s/{{GITHUB_RUN_NUMBER}}/$GITHUB_RUN_NUMBER/g; s/{{BUILD_DATE}}/$(date)/g" version.yml.template > client/version.yml cat server/src/main/resources/version.yml - - - name: Build - run: | - ./scripts/build-all.sh - name: Login to Docker Hub uses: docker/login-action@v1 @@ -36,8 +27,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Push - run: | - docker push instituutnederlandsetaal/galahad-proxy:dev - docker push instituutnederlandsetaal/galahad-server:dev - docker push instituutnederlandsetaal/galahad-client:dev + - name: Build and push + run: cd scripts && ./build-and-push-all.sh + env: + VERSION_LABEL: dev diff --git a/.github/workflows/publish-prod.yml b/.github/workflows/publish-prod.yml new file mode 100644 index 0000000..a2db155 --- /dev/null +++ b/.github/workflows/publish-prod.yml @@ -0,0 +1,33 @@ +name: Prod images to docker + +on: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + prod-images-to-docker: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + # The commit-version job made a commit, but default checkout still refers to the original commit that triggered this job + # so make sure we are looking at the right commit + - run: git checkout HEAD + - name: Version info + run: | + sed "s~{{GITHUB_REPOSITORY}}~$GITHUB_REPOSITORY~g; s/{{VERSION_LABEL}}/release/g; s/{{GITHUB_REF_TYPE}}/$GITHUB_REF_TYPE/g; s/{{GITHUB_REF_NAME}}/$GITHUB_REF_NAME/g; s/{{GITHUB_SHA}}/$GITHUB_SHA/g; s/{{GITHUB_WORKFLOW}}/$GITHUB_WORKFLOW/g; s/{{GITHUB_RUN_NUMBER}}/$GITHUB_RUN_NUMBER/g; s/{{BUILD_DATE}}/$(date)/g" version.yml.template > server/src/main/resources/version.yml + sed "s~{{GITHUB_REPOSITORY}}~$GITHUB_REPOSITORY~g; s/{{VERSION_LABEL}}/release/g; s/{{GITHUB_REF_TYPE}}/$GITHUB_REF_TYPE/g; s/{{GITHUB_REF_NAME}}/$GITHUB_REF_NAME/g; s/{{GITHUB_SHA}}/$GITHUB_SHA/g; s/{{GITHUB_WORKFLOW}}/$GITHUB_WORKFLOW/g; s/{{GITHUB_RUN_NUMBER}}/$GITHUB_RUN_NUMBER/g; s/{{BUILD_DATE}}/$(date)/g" version.yml.template > client/version.yml + cat server/src/main/resources/version.yml + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + run: cd scripts && ./build-and-push-all.sh + env: + VERSION_LABEL: latest diff --git a/readme.md b/readme.md index a4f77c3..6d6249a 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,8 @@ # GaLAHaD (0.9.0) Generating Linguistic Annotations for Historical Dutch -[![Version, build and push to Docker Hub](https://github.com/INL/Galahad/actions/workflows/publish-dev.yml/badge.svg)](https://github.com/INL/Galahad/actions/workflows/publish-dev.yml) +[![Dev images to docker](https://github.com/INL/Galahad/actions/workflows/publish-dev.yml/badge.svg)](https://github.com/INL/Galahad/actions/workflows/publish-dev.yml) +[![Prod images to docker](https://github.com/INL/Galahad/actions/workflows/publish-prod.yml/badge.svg)](https://github.com/INL/Galahad/actions/workflows/publish-prod.yml) [![Tests](https://github.com/INL/Galahad/actions/workflows/tests.yml/badge.svg?branch=development&event=push)](https://github.com/INL/Galahad/actions/workflows/tests.yml) ### GaLAHaD-related Repositories diff --git a/scripts/build-and-push-all.sh b/scripts/build-and-push-all.sh new file mode 100755 index 0000000..3fe3f31 --- /dev/null +++ b/scripts/build-and-push-all.sh @@ -0,0 +1,10 @@ +# Set the default label +: ${VERSION_LABEL:=dev} + +./build-all.sh + +echo "Will push galahad images with version <$VERSION_LABEL>. Set VERSION_LABEL to override this." + +docker push instituutnederlandsetaal/galahad-proxy:$VERSION_LABEL +docker push instituutnederlandsetaal/galahad-server:$VERSION_LABEL +docker push instituutnederlandsetaal/galahad-client:$VERSION_LABEL