-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (104 loc) · 3.41 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: build_and_publish
on:
push:
branches:
- stable
- main
jobs:
get_version:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
id: git_checkout
uses: actions/checkout@v3
- name: Get version
id: get_version
run: |
CURRENT_VERSION=$(sed -n '/^current_version/{ s/^.\+ = //; p; }' .bumpversion.cfg)
if [[ "${GITHUB_REF}" == 'refs/heads/stable' ]]; then
echo "::set-output name=version::${CURRENT_VERSION}"
elif [[ "${GITHUB_REF}" == 'refs/heads/main' ]]; then
DEV_VERSION="${CURRENT_VERSION}"+dev$(echo "${GITHUB_SHA}" | cut -c-7)
echo "::set-output name=version::${DEV_VERSION}"
echo "::set-output name=bump_version::yes"
else
echo "got bad gh ref: ${GITHUB_REF}" 1>&2
exit 1
fi
outputs:
bump_version: ${{ steps.get_version.outputs.bump_version }}
version: ${{ steps.get_version.outputs.version }}
build_and_publish_on_conda:
runs-on: ubuntu-latest
needs: get_version
defaults:
run:
shell: bash -l {0}
env:
VERSION: ${{ needs.get_version.outputs.version }}
steps:
- name: Checkout code
id: git_checkout
uses: actions/checkout@v3
- name: Setup conda
id: setup_conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
miniforge-variant: Mambaforge-pypy3
channels: umccr,bioconda,conda-forge,defaults
channel-priority: true
- name: Prepare env
id: prepare_env
run: |
mamba install boa anaconda-client bump2version
# When on development branch (inferred from bump_version value), append '-dev' to package name and set
# commit-specific version
- name: Set package name and version
if: ${{ needs.get_version.outputs.bump_version == 'yes' }}
run: |
sed -i 's/name: bactabolize/name: bactabolize-dev/' conda/bactabolize/meta.yaml;
bump2version patch \
--new-version "${VERSION}" \
--allow-dirty \
--no-commit
- name: Build and upload conda package
run: |
conda mambabuild \
--token "${{ secrets.ANACONDA_TOKEN }}" \
conda/bactabolize/
# build_and_publish_on_dockerhub:
# runs-on: ubuntu-latest
# needs:
# - get_version
# - build_and_publish_on_conda
# # Only push on push to stable, which implicitly should be only version bumps
# if: github.ref == 'refs/heads/stable'
# defaults:
# run:
# shell: bash -l {0}
# env:
# DOCKERHUB_REPO: "docker.io/scwatts/bactabolize"
# VERSION: ${{ needs.get_version.outputs.version }}
# steps:
# - name: Checkout code
# id: git_checkout
# uses: actions/checkout@v3
# - name: Build Docker image
# run: |
# docker build \
# --tag "${DOCKERHUB_REPO}:${VERSION}" \
# --file docker/Dockerfile \
# ./
# - name: DockerHub auth
# run: |
# echo "${{ secrets.DOCKERHUB_TOKEN }}" | \
# docker login \
# --username "${{ secrets.DOCKERHUB_USERNAME }}" \
# --password-stdin
# - name: DockerHub push
# run: |
# docker push "${DOCKERHUB_REPO}:${VERSION}"