-
Notifications
You must be signed in to change notification settings - Fork 18
145 lines (131 loc) · 5.03 KB
/
Copy pathrelease_snapshot.yml
File metadata and controls
145 lines (131 loc) · 5.03 KB
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
# Release Snapshot Workflow (@next)
#
# This workflow automatically creates snapshot releases for every commit to main.
# It allows users to install and test the latest features before they become full releases.
#
# How it works:
# 1. Triggered automatically on every push to main (except (full) Release PR merges)
# 2. Builds all packages
# 3. Versions packages using changesets based on the merged PR's changeset
# 4. Publishes NPM packages with @next tag
# 5. Builds and publishes Docker images with @next tag to GitHub Container Registry
#
# Published artifacts:
# - NPM packages: All @ensnode/* packages published with @next tag
# - Docker images: ensindexer, ensadmin, ensapi, ensrainbow published with @next tag
# - No GitHub releases or tags are created
#
# Version behavior:
# - Packages advance to the version indicated in the changeset of the merged PR
# - All packages use "fixed" versioning and advance together
# - Each snapshot represents the pre-stable state of main
#
# Use cases:
# - Development and testing environments
# - Testing upcoming features before stable release
# - Experimenting with new functionality
# - Integration testing with latest main branch
#
# Important notes:
# - Snapshot releases are NOT stable and should be used with caution
# - Only use @next for development/testing, not production
# - Automatically triggered - cannot be run manually
# - Only runs if there are changes to publish (hasChanges check)
# - Requires PR to be approved by ensnode team (main branch is protected)
# - Installation: npm install @ensnode/package-name@next
#
# Documentation: https://ensnode.io/docs/contributing/releases#snapshot-release
name: Release Snapshot (@next)
permissions:
contents: read
id-token: write
packages: write
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build-and-publish-npm:
name: Build & Publish Snapshot Packages to NPM
if: github.repository == 'namehash/ensnode' && !contains(github.event.head_commit.message, 'changeset-release/main')
runs-on: blacksmith-4vcpu-ubuntu-2204
outputs:
hasChanges: ${{ steps.snapshot.outputs.hasChanges }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/setup_node_environment
- name: Build snapshot packages
run: pnpm packages:prepublish
- name: Version snapshot packages
id: snapshot
run: |
pnpm changeset:next
# Check if there are any changes to publish
if [ -n "$(git status --porcelain)" ]; then
echo "hasChanges=true" >> $GITHUB_OUTPUT
else
echo "hasChanges=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish snapshot packages to NPM
if: steps.snapshot.outputs.hasChanges == 'true'
run: pnpm changeset:publish:next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
build-and-publish-ghcr:
name: Build & Publish Snapshot Docker Images to GHCR
runs-on: blacksmith-4vcpu-ubuntu-2204
if: github.repository == 'namehash/ensnode' && !contains(github.event.head_commit.message, 'changeset-release/main') && needs.build-and-publish-npm.outputs.hasChanges == 'true'
needs: [build-and-publish-npm]
strategy:
fail-fast: false
matrix:
app: [ensindexer, ensadmin, ensrainbow, ensapi]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Generate docker image snapshot tag
id: snapshot-tag
run: |
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
SHORT_SHA=$(git rev-parse --short HEAD)
SNAPSHOT_TAG="next-${TIMESTAMP}-${SHORT_SHA}"
echo "tag=$SNAPSHOT_TAG" >> $GITHUB_OUTPUT
- name: Build and publish snapshot docker images to GHCR
uses: ./.github/actions/build_docker_image
with:
image: ghcr.io/${{ github.repository }}/${{ matrix.app }}
dockerfile: apps/${{ matrix.app }}/Dockerfile
registry_user: ${{ github.actor }}
registry_token: ${{ secrets.GITHUB_TOKEN }}
tags: |
type=raw,value=next
type=raw,value=${{ steps.snapshot-tag.outputs.tag }}
type=sha
build-and-publish-lambdas:
name: Build & Publish Snapshot Lambdas
runs-on: blacksmith-4vcpu-ubuntu-2204
if: github.repository == 'namehash/ensnode' && !contains(github.event.head_commit.message, 'changeset-release/main') && needs.build-and-publish-npm.outputs.hasChanges == 'true'
needs: [build-and-publish-npm]
strategy:
fail-fast: false
matrix:
lambda: [fallback-ensapi]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Build and Publish Lambda
uses: ./.github/actions/build_and_publish_lambda
with:
name: ${{ matrix.lambda }}
version: next