From 226e8127c10e1aacfda6f3bd9becc5fca60a6965 Mon Sep 17 00:00:00 2001 From: Felicia Date: Mon, 3 Jun 2024 13:51:05 -0700 Subject: [PATCH] print git metadata --- .../actions/publish-to-jamsocket/action.yml | 61 +++---------------- .github/workflows/test-action.yml | 15 +++-- 2 files changed, 15 insertions(+), 61 deletions(-) diff --git a/.github/actions/publish-to-jamsocket/action.yml b/.github/actions/publish-to-jamsocket/action.yml index 879ff41..31aac5c 100644 --- a/.github/actions/publish-to-jamsocket/action.yml +++ b/.github/actions/publish-to-jamsocket/action.yml @@ -1,62 +1,17 @@ name: 'Deploy to Jamsocket' description: 'This action will handle deploying session backend code to your Jamsocket service.' -inputs: - jamsocket_api_token: - description: 'API Token for Jamsocket authentication' - required: true - jamsocket_account: - description: 'Name of your Jamsocket account' - required: true - jamsocket_service: - description: 'Name of your Jamsocket service' - required: true - docker_build_context: - description: 'Path to your Docker build context' - required: true - dockerfile_path: - description: 'Path to your Dockerfile' - required: true + runs: using: 'composite' steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Set JAMCR_USER from token - shell: bash - run: | - JAMSOCKET_API_TOKEN=${{ inputs.jamsocket_api_token }} - JAMCR_USER="${JAMSOCKET_API_TOKEN%%.*}" - echo "JAMCR_USER=$JAMCR_USER" >> $GITHUB_ENV - - - name: Set JAMCR_PASS from token - shell: bash + - name: Get commit metadata + id: commit_info run: | - JAMSOCKET_API_TOKEN=${{ inputs.jamsocket_api_token }} - JAMCR_PASS="${JAMSOCKET_API_TOKEN#*.}" - echo "JAMCR_PASS=$JAMCR_PASS" >> $GITHUB_ENV - - - name: Log into Jamsocket's Docker registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: new.jamcr.io - username: ${{ env.JAMCR_USER }} - password: ${{ env.JAMCR_PASS }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: new.jamcr.io/${{ inputs.jamsocket_account }}/${{ inputs.jamsocket_service }} - tags: | - type=raw,value=latest - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ${{ inputs.docker_build_context }} - file: ${{ inputs.dockerfile_path }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV + echo "COMMIT_MESSAGE=${{ github.event.head_commit.message }}" >> $GITHUB_ENV + echo "BRANCH_NAME=${{ github.ref }}" >> $GITHUB_ENV + echo "GITHUB_ACCOUNT_NAME=${{ github.actor }}" >> $GITHUB_ENV + echo "GITHUB_REPOSITORY_NAME=${{ github.repository }}" >> $GITHUB_ENV diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index fc7e0ae..8685d4d 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -12,11 +12,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Deploy to Jamsocket - uses: jamsocket/jamsocket-deploy-action@v0.1.0 - with: - jamsocket_api_token: ${{ secrets.JAMSOCKET_API_TOKEN }} - jamsocket_account: ffeliciachang - jamsocket_service: renaissance-earth - docker_build_context: ./server - dockerfile_path: ./server/Dockerfile.jamsocket + - name: Get commit metadata + id: commit_info + run: | + echo "Commit Hash: ${{ github.event.pull_request.head.sha }}" + echo "Commit Message: ${{ github.event.head_commit.message }}" + echo "BRANCH_NAME: ${{ github.ref_name }}" + echo "Respository: ${{ github.repository }}"