Skip to article content
FrontendXLesson 12 / 16

Release Promotion and Environments

Take one task-board application from local tests to a real delivery pipeline: continuous integration fundamentals, push and pull-request quality gates, lint, type-check, unit, component and end-to-end gates, dependency caching, matrix builds, artifacts and checksums, secrets and supply-chain security, release promotion, staging and production, rollback and observability.

advanced · about 35 minutes · 4 exercises

  • Explain
  • Implement
  • Debug
  • Test

What you will be able to do

#
  • Trigger a release on a version tag instead of every push.
  • Promote a tested artifact rather than rebuilding.
  • Explain the role of an environment approval.

Overview

#

Promote, do not rebuild

A release is a decision to make a verified artifact available. The safest release promotes the exact artifact that passed the gates, rather than rebuilding from source. Rebuilding can produce different bytes from the same commit, so the tested artifact and the released artifact may differ.

snippet.yaml
name: release
on:
  push:
    tags: ['v*']
jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          name: web-dist
          path: dist
      - run: sha256sum dist/app.tar.gz
      - run: echo creating release for ${{ github.ref_name }}

Triggers

A release workflow should trigger on a tag or a manual dispatch, not on every push. Triggering on every push creates releases for unreviewed commits. A tag such as v1.4.0 is an explicit, reviewable marker.

Semantic versioning

Semantic versioning communicates intent: patch for a backward-compatible fix, minor for a backward-compatible addition, major for a breaking change. The tag should match the version in the manifest, and a check can enforce that they agree.

Environments and approvals

A release job can target an environment that requires approval. The approval is a gate: the artifact is ready, but a human must confirm before it is published. This separates "the build is good" from "we choose to ship it now".

Immutable releases

Once published, a release artifact should not change. If a problem is found, publish a new version rather than overwriting the old bytes. Immutability is what makes a version number trustworthy.

Sandbox boundary

The browser sandbox cannot create a release or download a CI artifact. It can validate a version string, which is the pure part of the release check.

Exercises

#

Reference answers and expected output are authored, not executed in this browser. Nothing you type is run, and there is no Run or Pass control on this page.

  1. Exercise 1Implement

    Write a release workflow that triggers on tags matching v* and downloads the web-dist artifact before creating the release.

    starter.yaml
    name: release
    on:
      push:
        # add a tag trigger
    jobs:
      release:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
    

    Reveal the reference answer
    reference.yaml
    name: release
    on:
      push:
        tags: ['v*']
    jobs:
      release:
        runs-on: ubuntu-latest
        permissions:
          contents: write
        steps:
          - uses: actions/checkout@v4
          - uses: actions/download-artifact@v4
            with:
              name: web-dist
              path: dist
          - run: echo creating release for ${{ github.ref_name }}

    Authored expected output: A release workflow triggered by v* tags that downloads web-dist.

    Tag triggers make releases explicit. Downloading the artifact promotes the tested bytes instead of rebuilding.

  2. Exercise 2Debug

    This release workflow creates a release on every push to main. Fix the trigger so it only runs for version tags.

    starter.yaml
    on:
      push:
        branches: [main]
    

    Reveal the reference answer
    reference.yaml
    on:
      push:
        tags: ['v*']
    

    Authored expected output: The trigger is a tag filter for v* instead of a branch filter.

    A branch trigger releases unreviewed commits. A tag trigger ties the release to an explicit version marker.

  3. Exercise 3Test

    Write a function isSemverTag(tag) that returns true only for strings like v1.2.3, v0.1.0 and v10.20.30.

    starter.javascript
    function isSemverTag(tag) {
      // return true or false
    }

    Reveal the reference answer
    reference.javascript
    function isSemverTag(tag) {
      return typeof tag === 'string' && /^v\d+\.\d+\.\d+$/.test(tag);
    }

    Authored expected output: isSemverTag('v1.2.3') is true; isSemverTag('1.2.3') and isSemverTag('v1.2') are false.

    Enforcing the tag shape before a release prevents malformed version markers from reaching the registry.

  4. Exercise 4Explain

    Explain why you should promote the exact artifact that was tested instead of rebuilding at release time.

    Reveal the reference answer
    reference.text
    Rebuilding from the same commit can produce different bytes because of timestamps, dependency resolution or build environment differences. If the released artifact differs from the tested one, the tests no longer describe what shipped. Promoting the tested artifact keeps the evidence and the release identical.

    Authored expected output: A correct answer connects byte identity to the validity of the test evidence.

    Tests validate specific bytes. If the release rebuilds, the test evidence no longer applies to what users receive.

Common misconceptions

#
  • Rebuilding at release time is equivalent to promoting.
  • A release should trigger on every push to main.
  • Overwriting a published release artifact is fine.

Follow-up practice

#
  • cicd-13-staging-and-production

Related resources

#

Your progress

#

Answers, drafts and completion marks are stored only in this browser. Nothing is sent to a server and no account is used.

Verification: authored. Answers and outputs on this page are authored reference material, not executed results.

© 2026 FrontendX. All rights reserved.