Skip to content

Commit

Permalink
Merge pull request #13 from Overmuse/SR/update_tags
Browse files Browse the repository at this point in the history
change tag format to semver
  • Loading branch information
SebRollen authored Apr 14, 2021
2 parents 01ca363 + 23fd8d3 commit 9d99193
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 133 deletions.
43 changes: 2 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
on:
push:
branches:
- main
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- 'deployment.yml'
- 'src/**'
pull_request:
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- 'deployment.yml'
- 'src/**'
- '.github/**'

name: Continuous integration

Expand Down Expand Up @@ -95,7 +87,7 @@ jobs:
command: clippy
args: -- -D warnings

coverage:
test_coverage:
name: Test & Coverage
runs-on: ubuntu-latest
needs: [fmt, clippy]
Expand Down Expand Up @@ -128,34 +120,3 @@ jobs:
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true

build:
name: Build and push to registry
runs-on: ubuntu-latest
needs: [coverage, fmt, clippy]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup ssh key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{secrets.GH_ACTIONS_SSH_PRIVATE_KEY}}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: alpaca-data-relay
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.sha }}
run: |
docker build --ssh default -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy
on:
release:
types: [published]

jobs:
cancel-previous:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- name: Cancel actions
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup git credentials
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: ${{secrets.GIT_USER_CREDENTIALS}}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Run tests
run: cargo test

build:
name: Build and push to registry
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup ssh key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{secrets.GH_ACTIONS_SSH_PRIVATE_KEY}}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: alpaca-data-relay
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.event.release.name }}
run: |
docker build --ssh default -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
Loading

0 comments on commit 9d99193

Please sign in to comment.