Skip to content

Commit

Permalink
Deploy with sync sha
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Apr 4, 2024
1 parent d9c6006 commit 793b4a1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ jobs:
install: true

- name: Read Pharo-sync-commit file and set to env variable
run: |
bin/export-sync-commit.sh
echo "SHA_OR_BRANCH=${SHA_OR_BRANCH}" >> $GITHUB_ENV
run: bin/export-sync-commit.sh

- name: Build Docker image and store in cache
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ permissions:
contents: write

jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
SHA_OR_BRANCH: ${{ steps.export-sync-commit.outputs.SHA_OR_BRANCH }}
steps:
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Export sync commit
id: export-sync-commit
run: bin/export-sync-commit.sh

build-and-push-image:
if: github.repository_owner == 'exercism' # Stops this job from running on forks.
uses: exercism/github-actions/.github/workflows/docker-build-push-image.yml@main
needs: prepare
secrets:
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID}}
AWS_REGION: ${{secrets.AWS_REGION}}
AWS_ECR_ACCESS_KEY_ID: ${{secrets.AWS_ECR_ACCESS_KEY_ID}}
AWS_ECR_SECRET_ACCESS_KEY: ${{secrets.AWS_ECR_SECRET_ACCESS_KEY}}
DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKERHUB_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
DOCKER_BUILD_ARGS: SHA_OR_BRANCH=${{needs.prepare.outputs.SHA_OR_BRANCH}}
5 changes: 5 additions & 0 deletions bin/export-sync-commit.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env sh

export SHA_OR_BRANCH=$(sed -n '3p' Pharo-sync-commit)

if [ -n "$GITHUB_ACTIONS" ]; then
echo "SHA_OR_BRANCH=${SHA_OR_BRANCH}" >> $GITHUB_ENV
echo "SHA_OR_BRANCH=${SHA_OR_BRANCH}" >> $GITHUB_OUTPUT
fi
2 changes: 1 addition & 1 deletion bin/run-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi
bin/export-sync-commit.sh

# build docker image
docker build --build-arg SHA_OR_BRANCH="${SHA_OR_BRANCH}" --rm -t exercism/pharo-smalltalk-test-runner .
docker build --build-arg SHA_OR_BRANCH="${SHA_OR_BRANCH}" --rm --no-cache -t exercism/pharo-smalltalk-test-runner .

# Create output directory if it doesn't exist
output_dir="$3"
Expand Down
2 changes: 1 addition & 1 deletion bin/run-tests-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set -e

# Build the Docker image
docker build --build-arg GROUP_NAMES=testRunnerTests --rm -t exercism/pharo-smalltalk-test-runner .
docker build --build-arg GROUP_NAMES=testRunnerTests --rm --load -t exercism/pharo-smalltalk-test-runner .

# Run the Docker image using the settings mimicking the production environment
docker run \
Expand Down

0 comments on commit 793b4a1

Please sign in to comment.