Skip to content

Commit

Permalink
Separate build and ci workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed May 24, 2023
1 parent 7aa8032 commit 26c370f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 60 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build

on:
workflow_dispatch:

jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1

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

- name: Install dependencies
run: shards install

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- if: matrix.os == 'ubuntu-latest'
name: Build binary (Linux)
run: |
mkdir build
docker-compose run --rm app crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-linux --static --no-debug --release
- if: matrix.os == 'macos-latest'
name: Build binary (macOS)
run: |
mkdir build
crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-osx --release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build

- if: github.ref == 'refs/heads/master'
name: Upload to S3
uses: shallwefootball/upload-s3-action@v1.3.3
with:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }}
aws_key_id: ${{ secrets.AWS_KEY }}
source_dir: build
destination_dir: ""

- if: startsWith(github.ref, 'refs/tags/')
name: Upload to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: build/*
overwrite: true
file_glob: true
60 changes: 0 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,63 +60,3 @@ jobs:

- name: Run ameba
run: bin/ameba

build:
name: Build
needs: [test]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1

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

- name: Install dependencies
run: shards install

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- if: matrix.os == 'ubuntu-latest'
name: Build binary (Linux)
run: |
mkdir build
docker-compose run --rm app crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-linux --static --no-debug --release
- if: matrix.os == 'macos-latest'
name: Build binary (macOS)
run: |
mkdir build
crystal build src/mint.cr -o build/mint-${GITHUB_REF_SLUG}-osx --release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build

- if: github.ref == 'refs/heads/master'
name: Upload to S3
uses: shallwefootball/upload-s3-action@v1.3.3
with:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }}
aws_key_id: ${{ secrets.AWS_KEY }}
source_dir: build
destination_dir: ""

- if: startsWith(github.ref, 'refs/tags/')
name: Upload to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: build/*
overwrite: true
file_glob: true

0 comments on commit 26c370f

Please sign in to comment.