Skip to content

Commit

Permalink
Merge pull request #24 from Overmuse/SR/update_tags
Browse files Browse the repository at this point in the history
change to semver
  • Loading branch information
SebRollen authored Apr 14, 2021
2 parents e7226ae + 1de6b92 commit c265390
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 118 deletions.
43 changes: 1 addition & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
on:
push:
branches:
- main
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- 'deployment.yml'
- 'src/**'
- '.github/**'
pull_request:
paths:
- 'Cargo.toml'
Expand Down Expand Up @@ -97,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 @@ -130,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: trader
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: trader
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
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trader"
version = "0.3.0"
version = "1.0.0"
authors = ["RollenRegistratorBot <[email protected]>"]
edition = "2018"

Expand Down
36 changes: 0 additions & 36 deletions deployment.yml

This file was deleted.

0 comments on commit c265390

Please sign in to comment.