-
Notifications
You must be signed in to change notification settings - Fork 12
101 lines (90 loc) · 3.41 KB
/
release.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Automated Release
# Controls when the workflow will run
on:
# Triggers the workflow on updates to the "main" branch which include a version tag
push:
tags:
- '**' # Push events to every tag including hierarchical tags like v1.0/beta
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
env:
branch-name: automated-dev-update
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-tag:
runs-on: ubuntu-latest
steps:
- name: Check tag is version tag
id: check
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
REF="${{ github.ref }}"
VERSION="${REF##refs/tags/v}"
echo "Tag starts with 'v'."
echo "Version: ${VERSION}"
echo "Continuing..."
echo "version=${VERSION}" >> $GITHUB_OUTPUT
exit 0
else
echo "The tag doesn't start with 'v'. To release a new version, the tag must start with 'v'"
exit 1
fi
outputs:
version: ${{ steps.check.outputs.version }}
release:
environment: release
runs-on: ubuntu-latest
needs: [check-tag]
container:
image: node:20
steps:
- name: Checkout the main branch
uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3 quilt
- name: Build Tarball
id: build
run: |
git config --global --add safe.directory /__w/sagemaker-code-editor/sagemaker-code-editor
sh ./scripts/install.sh -t ${{ needs.check-tag.outputs.version }}
TARBALL_NAME="code-editor${{ needs.check-tag.outputs.version }}.tar.gz"
echo "tarball_name=${TARBALL_NAME}" >> $GITHUB_OUTPUT
SHA256_HASH=$(sha256sum ${TARBALL_NAME} | awk '{ print $1 }')
echo "sha256_hash=${SHA256_HASH}" >> $GITHUB_OUTPUT
- name: Publish Release
id: publish
uses: softprops/action-gh-release@v2
with:
name: Code Editor ${{ needs.check-tag.outputs.version }}
tag_name: v${{ needs.check-tag.outputs.version }}
files: |
${{ steps.build.outputs.tarball_name }}
outputs:
sha256_hash: ${{ steps.build.outputs.sha256_hash }}
assets: ${{ steps.publish.outputs.assets }}
update-feedstock-files:
runs-on: ubuntu-latest
needs: [check-tag, release]
steps:
- name: Clone the feedstock repository
uses: actions/checkout@v4
with:
repository: 'conda-forge/sagemaker-code-editor-feedstock'
ref: 'dev'
- name: Create a new dev branch
run: |
git checkout -b ${{ env.branch-name }}
- name: Update meta.yaml
run: |
VERSION=${{ needs.check-tag.outputs.version }}
sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml
URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}"
sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml
SHA256=${{ needs.release.outputs.sha256_hash }}
sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml
- name: Run diff
run: git diff