-
Notifications
You must be signed in to change notification settings - Fork 5
149 lines (139 loc) · 4.25 KB
/
release.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---
name: Release NEAT
on:
push:
branches:
- main
env:
PYTHON_VERSION: "3.11"
jobs:
release-to-pypi:
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install core dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install -E all
- name: Dump last commit message to file
run: git log -1 --pretty=%B > last_git_message.txt
- name: Dump last tag to file
run: git describe --tags --abbrev=0 > last_version.txt
- name: Bump Version
run: python dev.py bump --verbose
- id: version
name: Read the new version
# Read the version from the cognite/neat/_version.py file
run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite/neat/_version.py)" >> $GITHUB_ENV
- name: Create CHANGELOG entry
if: env.version != '0.0.0'
run: python dev.py changelog
- name: Build package
if: env.version != '0.0.0'
run: poetry build
- name: Release to PyPI
if: env.version != '0.0.0'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --skip-existing --verbose dist/*
- name: Add entry to CHANGELOG
if: env.version != '0.0.0'
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
draft: false
tag: ${{ env.version }}
bodyFile: last_changelog_entry.md
# release-to-docker-hub:
# runs-on: ubuntu-latest
# environment: CD
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# version: 1.8.3
#
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USER }}
# password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
#
# - name: Export dependencies
# run: |
# poetry export -f requirements.txt --output requirements.txt --extras "all"
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - id: version
# name: NEAT Version
# # Read the version from the cognite/neat/_version.py file
# run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite/neat/_version.py)" >> $GITHUB_ENV
#
# - name: Build and push
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./Dockerfile
# platforms: linux/amd64,linux/arm64/v8
# push: true
# tags: cognite/neat:latest, cognite/neat:${{ env.version }}
#
# release-to-f25e:
# runs-on: ubuntu-latest
# environment: main
# permissions:
# id-token: write
# contents: read
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# version: 1.8.3
# virtualenvs-create: false
#
# - name: Azure login
# uses: azure/login@v1
# with:
# client-id: 7e26ba04-3da0-4241-b517-c12b8205af8a
# tenant-id: a9ae5b54-3600-4917-a9dc-3020723360b3
# subscription-id: fd108646-dc13-4d9a-9b8c-d9dbde664887
#
# - run: az acr login --name scsproduction
#
# - name: Export dependencies
# run: |
# poetry export -f requirements.txt --output requirements.txt --extras "all"
#
# - id: version
# name: Build Version
# run: echo "version=$(date -u '+%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Build and push
# uses: docker/build-push-action@v4
# env:
# VERSION: ${{ env.version }}
# with:
# context: .
# file: ./Dockerfile
# platforms: linux/amd64,linux/arm64/v8
# push: true
# tags: scsproduction.azurecr.io/neat:${{ env.version }}