Skip to content

Commit

Permalink
use output to create image
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnIckler committed Aug 20, 2024
1 parent 57bfca7 commit 1a9f76c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-main-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
WCA_LIVE_SITE=false
SHAKAPACKER_ASSET_HOST=https://staging-assets.worldcubeassociation.org
- name: Build and push Staging Image
id: build-staging
uses: docker/build-push-action@v6
with:
push: true
target: monolith
tags: |
${{ steps.login-ecr.outputs.registry }}/wca-on-rails:staging
wca-on-rails-staging
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
Expand All @@ -51,7 +51,7 @@ jobs:
# We build assets in docker and copy it out so we don't have to install all the dependencies in the GH Action
- name: Copy assets out of the container and push to S3
run: |
id=$(docker create wca-on-rails-staging)
id=$(docker create ${{steps.build-staging.outputs.imageid }})
docker cp $id:/rails/public/ ./assets
aws s3 sync ./assets s3://assets-staging.worldcubeassociation.org/assets/${{ env.SHORT_SHA }}
# There is no pipeline for staging so we manually force to update the image
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
- name: Build and Push Sidekiq image
id: build-prod
uses: docker/build-push-action@v6
with:
push: true
Expand All @@ -39,7 +40,7 @@ jobs:
# We build assets in docker and copy it out so we don't have to install all the dependencies in the GH Action
- name: Copy assets out of the container and push to S3
run: | # Copy from sidekiq so we don't create any race condition with the pipeline, the assets are identical
id=$(docker create ${{ steps.login-ecr.outputs.registry }}/wca-on-rails:sidekiq-production)
id=$(docker create ${{steps.build-prod.outputs.imageid }})
docker cp $id:/rails/public/ ./assets
aws s3 sync ./assets "s3://assets.worldcubeassociation.org/assets/${{ env.SHORT_SHA }}"
# this will trigger the deployment pipeline for prod
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging-deployment-from-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ jobs:
SHAKAPACKER_ASSET_HOST=https://staging-assets.worldcubeassociation.org
- name: Build Rails if triggered
if: steps.trigger-deployment.outputs.triggered == 'true'
id: build-staging
uses: docker/build-push-action@v6
with:
context: .
push: true
target: monolith
tags: |
${{ steps.login-ecr.outputs.registry }}/wca-on-rails:staging
wca-on-rails-staging
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Copy assets out of the container and push to S3 if triggered
if: steps.trigger-deployment.outputs.triggered == 'true'
run: |
id=$(docker create wca-on-rails-staging)
id=$(docker create ${{steps.build-staging.outputs.imageid }})
docker cp $id:/rails/public/ ./assets
aws s3 sync ./assets "s3://assets-staging.worldcubeassociation.org/assets/${{ env.SHORT_SHA }}"
- name: Deploy staging if triggered
Expand Down

0 comments on commit 1a9f76c

Please sign in to comment.