-
Notifications
You must be signed in to change notification settings - Fork 6
83 lines (70 loc) · 2.82 KB
/
condapublish.yml
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
# This is a basic workflow to help you get started with Actions
name: Publish on Conda-forge
# Controls when the workflow will run
on:
release:
types: [ published ]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
publish:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# variables
env:
REPO_NAME: ${{ github.event.repository.name }}
OWNER_NAME: ${{ github.repository_owner }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check-out src repository
- uses: actions/checkout@v2
with:
path: src
# Check-out feedstock
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_GITHUB }}
repository: ${{ github.repository_owner }}/${{ github.event.repository.name }}-feedstock
path: dst
# Re-sync
- name: Re-sync
run: |
cd dst
git remote add upstream https://github.com/conda-forge/${REPO_NAME}-feedstock.git
git fetch upstream
git checkout master
git merge upstream/master
# Generate meta.yaml
- name: Generate and push meta.yaml
run: |
PACKAGE_NAME=`echo $REPO_NAME | sed -e 's/-//g'`
cd src/${PACKAGE_NAME}
VERSION=`python -c 'exec(open("PandaToolsPkgInfo.py").read());print (release_version)'`
cd -
echo REPO_NAME=$REPO_NAME
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
echo PACKAGE_NAME=$PACKAGE_NAME
echo VERSION=$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
wget https://github.com/${OWNER_NAME}/${REPO_NAME}/archive/refs/tags/${VERSION}.tar.gz -q -O dummy.tar.gz
SHA256SUM=`sha256sum dummy.tar.gz`
SHA256SUM=${SHA256SUM% *}
echo SHA256SUM=$SHA256SUM
sed -e "s/___PACKAGE_VERSION___/${VERSION}/g" src/templates/conda_meta.yaml.template \
| sed -e "s/___SHA256SUM___/${SHA256SUM}/g" > dst/recipe/meta.yaml
- name: Push the change
run: |
cd dst
# use personal info since github-actions/[email protected] doesn't work for forked repos
git config --global user.name 'Tadashi Maeno'
git config --global user.email '[email protected]'
git diff --quiet && git diff --staged --quiet || git commit -am "${VERSION} github action"
git push
- name: Request pull request
env:
# use PAT instead of GITHUB_TOKEN since the latter cannot submit a PR
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
run: |
cd dst
gh pr create -t "${REPO_NAME} ${VERSION} github action" -b "automatic pull request"