Skip to content

Commit

Permalink
Add image build and artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
robbibt authored Aug 2, 2024
1 parent 3ec5129 commit 4f7b337
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 169 deletions.
59 changes: 58 additions & 1 deletion .github/workflows/dea-coastlines-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,64 @@ jobs:
For full integration test results, refer to the [Tests directory README](https://github.com/GeoscienceAustralia/dea-coastlines/tree/${{ github.head_ref }}/tests).
# Upload code coverage results
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# Add output GeoPackage data to Actions artifact so it can be downloaded
- uses: actions/upload-artifact@v3
with:
name: output_geopackage
path: ./data/processed/tests/coastlines_tests.gpkg

# Add output ESRI Shapefile data to Actions artifact so it can be downloaded
- uses: actions/upload-artifact@v3
with:
name: output_shps
path: ./data/processed/tests/coastlines_tests.shp.zip

push_ecr:
needs: [test]
runs-on: ubuntu-latest

# Only run on a push to the main branch OR a release
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release')

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::538673716275:role/github-actions-role
aws-region: ap-southeast-2

- name: Get tag for this build if it exists
if: github.event_name == 'release'
run: |
echo "RELEASE=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV
- name: Push release image to ECR
uses: whoan/docker-build-with-cache-action@master
if: github.event_name == 'release'
with:
registry: 538673716275.dkr.ecr.ap-southeast-2.amazonaws.com
image_name: ${{ env.IMAGE_NAME }}
image_tag: ${{ env.RELEASE }}

- name: Get git commit hash for push to main
if: github.event_name != 'release'
run: |
echo "TAG=dev$(git rev-parse --short HEAD)" \
>> $GITHUB_ENV
- name: Push unstable image to ECR
uses: whoan/docker-build-with-cache-action@master
if: github.event_name != 'release'
with:
registry: 538673716275.dkr.ecr.ap-southeast-2.amazonaws.com
image_name: ${{ env.IMAGE_NAME }}
image_tag: latest,${{ env.TAG }}
59 changes: 0 additions & 59 deletions .github/workflows/docker.yaml

This file was deleted.

109 changes: 0 additions & 109 deletions .github/workflows/test.yaml

This file was deleted.

0 comments on commit 4f7b337

Please sign in to comment.