Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cd.yaml #21

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
on:
push:
tags: ['v*']

name: Continuous delivery

jobs:
test:
uses: ./.github/workflows/ci.yaml
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: [test]
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: install cargo-get
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-get
- name: set variables
run: |
# vX.Y.Z is release version
# vX.Y.Z-foo is pre-release version
VERSION=${GITHUB_REF#refs/tags/v}
VERSION_NUMBER=${VERSION%-*}
PUBLISH_OPTS="--dry-run"
if [[ $VERSION == $VERSION_NUMBER ]]; then
PUBLISH_OPTS=""
fi
echo VERSION=${VERSION} >> $GITHUB_ENV
echo PUBLISH_OPTS=${PUBLISH_OPTS} >> $GITHUB_ENV
echo VERSION_NUMBER=${VERSION_NUMBER} >> $GITHUB_ENV
- name: check version integrity
run: |
ERROR=''
echo VERSION: ${VERSION}, VERSION_NUMBER: ${VERSION_NUMBER}
for dir in "." packages/apalis-{core,cron,redis,sql}; do
PACKAGE=$(cargo get --root $dir -n)
ACTUAL=$(cargo get --root $dir version)
if [[ $VERSION_NUMBER != $ACTUAL ]]; then
echo ${PACKAGE}: expected version ${VERSION_NUMBER} but found ${ACTUAL}
ERROR=1
fi
done
if [[ $ERROR ]]; then
exit 1
fi
- name: publish apalis-core
uses: actions-rs/cargo@v1
with:
command: publish
args: ${{ env.PUBLISH_OPTS }} -p apalis-core
- name: publish apalis-cron
uses: actions-rs/cargo@v1
with:
command: publish
args: ${{ env.PUBLISH_OPTS }} -p apalis-cron
- name: publish apalis-redis
uses: actions-rs/cargo@v1
with:
command: publish
args: ${{ env.PUBLISH_OPTS }} -p apalis-redis
- name: publish apalis-sql
uses: actions-rs/cargo@v1
with:
command: publish
args: ${{ env.PUBLISH_OPTS }} -p apalis-sql
- name: publish apalis
uses: actions-rs/cargo@v1
with:
command: publish
args: ${{ env.PUBLISH_OPTS }} -p apalis
6 changes: 5 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: [push, pull_request]
on:
push:
branches: [master, develop]
pull_request:
workflow_call:

name: Continuous integration

Expand Down