From 4b8f3472143efe66c2071ebb4e3f7ac237935186 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Mar 2023 21:38:41 +0100 Subject: [PATCH] use specific github refs & dockerhub tags --- .github/workflows/deploy.yml | 7 +++++++ .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8fb7fb9..ecb0061 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,7 @@ jobs: env: SECRET: ${{ secrets.SECRET }} CONFIGURATION: "this" + DOCKERHUB_OCELOT_TAG_JUST_BUILT: ${{ github.event.client_payload.BUILD_VERSION }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -22,6 +23,12 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true + - name: Set DOCKERHUB_OCELOT_TAG + run: | + if [ -z ${DOCKERHUB_OCELOT_TAG} ]; then + echo "DOCKERHUB_OCELOT_TAG=${DOCKERHUB_OCELOT_TAG_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Checkout Ocelot code uses: actions/checkout@v3 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6fabe56..81c6cca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,6 +13,7 @@ jobs: env: SECRET: ${{ secrets.SECRET }} CONFIGURATION: "this" + GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -22,6 +23,12 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true + - name: Set GITHUB_OCELOT_REF + run: | + if [ -z ${GITHUB_OCELOT_REF} ]; then + echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Checkout Ocelot code uses: actions/checkout@v3 with: @@ -174,12 +181,30 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + - name: Decrypt .env + run: gpg --quiet --batch --yes --decrypt --passphrase="${{ env.SECRET }}" --output .env .env.enc + - name: Load .env + uses: aarcangeli/load-dotenv@v1.0.0 with: - fetch-depth: 0 # Fetch full History for changelog + quiet: true + - name: Checkout Ocelot code + uses: actions/checkout@v3 + with: + repository: 'Ocelot-Social-Community/Ocelot-Social' + ref: ${{ env.GITHUB_OCELOT_REF }} + path: 'ocelot/' + fetch-depth: 0 + - name: Setup env + run: | + echo "OCELOT_VERSION=$(node -p -e "require('./ocelot/package.json').version")" >> $GITHUB_ENV + echo "BRANDED_VERSION=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${BRANDED_VERSION}-ocelot.social${OCELOT_VERSION}" >> $GITHUB_ENV - name: Repository Dispatch uses: peter-evans/repository-dispatch@v2 with: token: ${{ github.token }} event-type: trigger-ocelot-brand-build-success repository: ${{ github.repository }} - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${{ github.event.client_payload.VERSION }}", "BUILD_DATE": "${{ github.event.client_payload.BUILD_DATE }}", "BUILD_COMMIT": "${{ github.event.client_payload.BUILD_COMMIT }}", "BUILD_VERSION": "${{ github.event.client_payload.BUILD_VERSION }}"}' \ No newline at end of file + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "OCELOT_VERSION": "${{ env.OCELOT_VERSION }}", "BRANDED_VERSION": "${{ env.BRANDED_VERSION }}", "BUILD_DATE": "${{ env.BUILD_DATE }}", "BUILD_COMMIT": "${{ env.BUILD_COMMIT }}", "BUILD_VERSION": "${{ env.BUILD_VERSION }}"}' \ No newline at end of file