Skip to content

Commit

Permalink
Image version
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Rogerson committed Sep 27, 2023
1 parent 058b1a2 commit e8c44f2
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:
branches:
- '**'
pull_request:
types: [opened, synchronize]
types:
- opened
- synchronize
- reopened
- edited
release:
types: [ published ]

Expand Down Expand Up @@ -36,28 +40,30 @@ jobs:
name: build
path: ./dist

# test:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository
# uses: actions/checkout@v3
# - name: Setup node
# uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Download build artifact
# uses: actions/download-artifact@v3
# with:
# name: build
# path: ./dist
# - run: npm install --no-save tap-xunit
# - run: mkdir -p _out/unit _out/e2e
# - run: npm test -- --timeout=1m
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: ./dist
- run: npm install --no-save tap-xunit
- run: mkdir -p _out/unit _out/e2e
- run: npm test -- --timeout=1m

release-to-staging:
# if: github.event_name == 'pull_request' && github.base_ref == 'master'
needs: build
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master'
needs:
- build
- test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand Down Expand Up @@ -95,29 +101,29 @@ jobs:
with:
bump_level: "${{ env.increment }}"

# - name: Print current and next version
# run: |
# echo "Current version: ${{ steps.get_semver.outputs.current_version }}"
# echo "Next version: ${{ steps.get_semver.outputs.next_version }}"

- name: Generate image version
run: |
COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7)
IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH"
echo "Generated image version: $IMAGE_VERSION"
echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV
echo $IMAGE_VERSION > .version
- name: setup-docker
- name: Setup Docker
uses: docker-practice/actions-setup-docker@master

- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: ./dist

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }}
password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }}

- name: Build and push image
# run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push .
run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ env.image_version }} --push .
Expand Down

0 comments on commit e8c44f2

Please sign in to comment.