diff --git a/.env b/.env new file mode 100644 index 0000000..b241784 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +JOIN_IMAGE_TAG=2024-08-21--29-53 diff --git a/.github/workflows/image_build_push.yml b/.github/workflows/image_build_push.yml index f7d6b60..20e7c4f 100644 --- a/.github/workflows/image_build_push.yml +++ b/.github/workflows/image_build_push.yml @@ -1,50 +1,30 @@ name: docker-image-push-join on: - push: - branches: [ main ] - -env: - DOCKER_USER: ${{secrets.DOCKER_USER}} - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} + release: + types: [published] jobs: - - build: - + get-branch-name: runs-on: ubuntu-latest - + outputs: + branch_name: ${{ steps.get-branch-name.outputs.branch_name }} steps: + - name: Get branch name based on ref_type + id: get-branch-name + run: | + if [ "${{ github.ref_type }}" == "tag" ]; then + target_branch=${{ github.event.release.target_commitish }} + echo "branch_name=${target_branch}" >> "$GITHUB_OUTPUT" + elif [ "${{ github.ref_type }}" == "branch" ]; then + echo "branch_name=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" + fi - - uses: actions/checkout@v2 - - name: docker login - run: | # log into docker hub account - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD - - - name: Get current date # get the date of the build - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d--%M-%S')" - - - name: Run a one-line script - run: echo running in repo ${GITHUB_REPOSITORY#*/} branch ${GITHUB_REF##*/} on ${{ steps.date.outputs.date }} - - - name: build docker image - run: | - docker build -t $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} ./frontend - docker images - - - name: push docker image - run: | - docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} - - - name: Create artifact text file - run: | - echo ${{ steps.date.outputs.date }} > join_page_tag_file.txt - echo "Created tag text file" - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: join-page-image-tag - path: join_page_tag_file.txt - overwrite: true + build: + if: ${{ !contains(github.event.release.body, 'Triggered on e-mission-server new release. Bumping up release version.') }} + needs: [get-branch-name] + uses: e-mission/e-mission-server/.github/workflows/reusable_image_build_push.yml@master + with: + repo: ${{ github.event.repository.name }} + branch: ${{ needs.get-branch-name.outputs.branch_name }} + secrets: inherit diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9fbd86f..050a1d6 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,4 +1,5 @@ FROM node:21.7.2-alpine +LABEL org.opencontainers.image.source=https://github.com/e-mission/nrel-openpath-join-page RUN mkdir -p /public WORKDIR /public