Coder Social home page Coder Social logo

query-release-action's Introduction

Query Github Releases Action

Test

Github Action to Query Github releases and retrieve information about this release which can be used in other actions.

Contents

Action

Inputs

parameter description required default
token Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }}. false ${{ github.token }}
draft Get Draft Release false false
exclude-draft Exclude Draft Releases false
prerelease Get Prerelease false false
range Get Semver Versions from within a specific Range false
release Get Release false false
select Which release do you want to retrieve? (latest, previous, oldest, max, min, specific release) false latest

Environment Variables

ENV VAR Description Required Default
GITHUB_REPOSITORY The Repository name true -
GITHUB_REPOSITORY_OWNER The repository owner's name true -
GITHUB_API_URL The API URL false https://api.github.com
GITHUB_TOKEN Token for executing the action, can also be set through inputs true ${{ inputs.token }}

Outputs

parameter description
found A release is found
id The Release ID
name The name for the release
tag_name The tag name for the release
body Description of the Release
url The URL of the Release

Runs

This action is a node16 action.

Use Cases

Deploy specific release to environment

on:
  workflow_dispatch:
    inputs:
      version:
        description: The version to release
        default: previous
        required: false
        type: string
      environment:
        description: The environment to which to release
        default: production
        required: false
        type: string

jobs:
  deploy-release:
    runs-on: ubuntu-latest

    steps:
      - name: Get Release
        uses: query-github-release@v1
        id: get-release
        with:
          release: true
          select: ${{ inputs.version }}
      - uses: actions/checkout@v3
        if: steps.get-release.outputs.tag_name
        with:
          fetch-depth: 1
          ref: refs/tags/${{ steps.get-release.outputs.tag_name }}
      - name: "Deploy to environment: ${{ inputs.environment }}"
        run: |
          Deploying ${{ steps.get-release.outputs.tag_name }} to environment: ${{ inputs.environment }}

Rollback action

on:
  workflow_dispatch:
    inputs:
      version:
        description: The version to rollback to
        default: previous
        required: false
        type: string

jobs:
  rollback:
    runs-on: ubuntu-latest

    steps:
      - name: Get Release to Rollback to
        uses: query-github-release@v1
        id: get-release
        with:
          release: true
          select: ${{ inputs.version }}
      - name: Rollback action
        if: steps.get-release.outputs.tag_name
        run: |
          echo "Rolling back to: ${{ steps.get-release.outputs.tag_name }}"

query-release-action's People

Contributors

boitewitte avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

query-release-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.