From dc7872c1d83c162a2ef4f17656f2c84dd637466f Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Wed, 23 Aug 2023 10:07:32 -0500 Subject: [PATCH 1/3] 4 create GitHub action for creating container (#10) * Added github action for container building * first attempt * deactivate ghcr.io push * second ateempt --------- Co-authored-by: YONG WOOK KIM --- .github/workflows/graphql.yaml | 13 +++++++++---- CHANGELOG.md | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/graphql.yaml b/.github/workflows/graphql.yaml index fd2fe0a..bf781b6 100644 --- a/.github/workflows/graphql.yaml +++ b/.github/workflows/graphql.yaml @@ -4,16 +4,21 @@ on: push: branches: - main + - develop + - 'release/*' tags: - '*' - # only test with local branch pull_request: + branches: + - main + - develop + - 'release/*' # Certain actions will only run when this is the main repo. env: - MAIN_REPO: ncsa/standalone-smm-smile + MAIN_REPO: ncsa/standalone-smm-smile-graphql DOCKERHUB_ORG: socialmediamacroscope NCSAHUB: hub.ncsa.illinois.edu/socialmediamacroscope PLATFORM: "linux/amd64" @@ -92,7 +97,7 @@ jobs: if [ "$NCSAHUB_PUSH" == "true" ]; then IMAGES="${IMAGES}${NCSAHUB}/${IMAGE}:${tag}," fi - IMAGES="${IMAGES}ghcr.io/${OWNER_LC}/${IMAGE}:${tag}," + # IMAGES="${IMAGES}ghcr.io/${OWNER_LC}/${IMAGE}:${tag}," done IMAGES="${IMAGES%,*}" @@ -174,4 +179,4 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} repository: ${{ env.DOCKERHUB_ORG }}/${{ github.event.repository.name }} - readme-filepath: README.md + readme-filepath: README.md \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d544888..e2bc49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Added +- Github action for auto generating docker container [#4](https://github.com/ncsa/standalone-smm-smile-graphql/issues/4) + ## [0.2.8] - 2023-08-04 ### Added -- Add support for Twitter V2 API [#2](https://github.com/ncsa/standalone-smm-smile-graphql/issues/2) +- Support for Twitter V2 API [#2](https://github.com/ncsa/standalone-smm-smile-graphql/issues/2) From d30bc59b44a239378e28722427fef8cff4922065 Mon Sep 17 00:00:00 2001 From: YONG WOOK KIM Date: Fri, 19 Jan 2024 15:37:29 -0600 Subject: [PATCH 2/3] Turn on ghcrio post (#11) * Turn on ghcrio post * test 1 * added GITHUB PUSH to env * updated changelog * Change github package repository name * revert back --------- Co-authored-by: Chen Wang --- .github/workflows/graphql.yaml | 27 +++++++++++++++++++++------ CHANGELOG.md | 3 +++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/graphql.yaml b/.github/workflows/graphql.yaml index bf781b6..62c3903 100644 --- a/.github/workflows/graphql.yaml +++ b/.github/workflows/graphql.yaml @@ -67,18 +67,28 @@ jobs: tags="$BRANCH" fi + echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV + # should we push to dockerhub, and is there a README DOCKERHUB_PUSH="false" DOCKERHUB_README="false" if [ "${{ github.repository }}" == "${{ env.MAIN_REPO }}" ]; then - if [ "${{ secrets.DOCKERHUB_USERNAME }}" != "" -a "${{ secrets.DOCKERHUB_PASSWORD }}" != "" ]; then - DOCKERHUB_PUSH="true" - if [ -e "README.md" ]; then - DOCKERHUB_README="true" + if [ ${BRANCH} == "main" ]; then + if [ "${{ secrets.DOCKERHUB_USERNAME }}" != "" -a "${{ secrets.DOCKERHUB_PASSWORD }}" != "" ]; then + DOCKERHUB_PUSH="true" + if [ -e "README.md" ]; then + DOCKERHUB_README="true" + fi fi fi fi + # should we push to Github + GITHUB_PUSH="false" + if [ "${{ github.repository }}" == "${{ env.MAIN_REPO }}" ]; then + GITHUB_PUSH="true" + fi + # should we push to NCSA NCSAHUB_PUSH="false" if [ "${{ github.repository }}" == "${{ env.MAIN_REPO }}" ]; then @@ -97,7 +107,9 @@ jobs: if [ "$NCSAHUB_PUSH" == "true" ]; then IMAGES="${IMAGES}${NCSAHUB}/${IMAGE}:${tag}," fi - # IMAGES="${IMAGES}ghcr.io/${OWNER_LC}/${IMAGE}:${tag}," + if [ "$GITHUB_PUSH" == "true" ]; then + IMAGES="${IMAGES}ghcr.io/${OWNER_LC}/${IMAGE}:${tag}," + fi done IMAGES="${IMAGES%,*}" @@ -107,12 +119,14 @@ jobs: echo "DOCKERHUB_README=${DOCKERHUB_README}" echo "DOCKERHUB_PUSH=${DOCKERHUB_PUSH}" echo "NCSAHUB_PUSH=${NCSAHUB_PUSH}" + echo "GITHUB_PUSH=${GITHUB_PUSH}" echo "IMAGES=${IMAGES}" echo "BRANCH=${BRANCH}" >> $GITHUB_ENV echo "VERSION=${VERSION}" >> $GITHUB_ENV echo "DOCKERHUB_README=${DOCKERHUB_README}" >> $GITHUB_ENV echo "DOCKERHUB_PUSH=${DOCKERHUB_PUSH}" >> $GITHUB_ENV + echo "GITHUB_PUSH=${GITHUB_PUSH}" >> $GITHUB_ENV echo "NCSAHUB_PUSH=${NCSAHUB_PUSH}" >> $GITHUB_ENV echo "IMAGES=${IMAGES}" >> $GITHUB_ENV @@ -157,6 +171,7 @@ jobs: # build the docker images - name: Build and push docker + if: env.DOCKERHUB_PUSH == 'true' || env.NCSAHUB_PUSH == 'true' || env.GITHUB_PUSH == 'true' uses: docker/build-push-action@v3 with: context: ./ @@ -179,4 +194,4 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} repository: ${{ env.DOCKERHUB_ORG }}/${{ github.event.repository.name }} - readme-filepath: README.md \ No newline at end of file + readme-filepath: README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e2bc49a..5edb76c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Github action for auto generating docker container [#4](https://github.com/ncsa/standalone-smm-smile-graphql/issues/4) +### Changed +- Github action goes to Docker Hub when it only releases a tag [#8](https://github.com/ncsa/standalone-smm-smile-graphql/issues/8) + ## [0.2.8] - 2023-08-04 ### Added - Support for Twitter V2 API [#2](https://github.com/ncsa/standalone-smm-smile-graphql/issues/2) From a5dc91e4723b67b09a358dfe3b837614759714ae Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Tue, 23 Jan 2024 17:09:58 -0600 Subject: [PATCH 3/3] bump version up and update --- CHANGELOG.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5edb76c..39a209f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.3.0] - 2024-01-23 ### Added - Github action for auto generating docker container [#4](https://github.com/ncsa/standalone-smm-smile-graphql/issues/4) diff --git a/package-lock.json b/package-lock.json index 75d7456..0e34f14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "smile_graphql", - "version": "0.2.8", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 115d3d8..d0c5bde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smile_graphql", - "version": "0.2.8", + "version": "0.3.0", "private": true, "scripts": { "start": "forever ./bin/www",