Skip to content

Commit

Permalink
Merge branch 'master' into update-node
Browse files Browse the repository at this point in the history
  • Loading branch information
w9jds authored Dec 8, 2023
2 parents 5cd48b5 + 40d0dff commit b3f64e0
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 3 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Check for firebase-tools releases

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
check-releases:
runs-on: ubuntu-latest
outputs:
# A semver comparison result - We are the base, firebase-tools is the compare-to
comparison: ${{ steps.compare_versions.outputs.comparison-result }}
firebase-actions-release: ${{ fromJSON(steps.get_our_release.outputs.data).tag_name }}
firebase-tools-release: ${{ fromJSON(steps.get_their_release.outputs.data).tag_name }}
steps:
- name: Check our latest release
uses: octokit/request-action@v2.x
id: get_our_release
with:
route: GET /repos/${{ github.REPOSITORY }}/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check latest firebase-tools release
uses: octokit/request-action@v2.x
id: get_their_release
with:
route: GET /repos/firebase/firebase-tools/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: madhead/semver-utils@latest
id: compare_versions
with:
# A version to work with
version: "${{ fromJSON(steps.get_our_release.outputs.data).tag_name }}"
# A version to compare against
compare-to: "${{ fromJSON(steps.get_their_release.outputs.data).tag_name }}"

- name: Print our release version
run: echo "Our latest release is ${{ fromJSON(steps.get_our_release.outputs.data).tag_name }}"
- name: Print their release version
run: echo "Their latest release is ${{ fromJSON(steps.get_their_release.outputs.data).tag_name }}"
- name: Print the result
run: echo "${{ fromJSON(steps.get_our_release.outputs.data).tag_name }} ${{ steps.compare_versions.outputs.comparison-result }} ${{ fromJSON(steps.get_their_release.outputs.data).tag_name }}"

bump-version:
needs: check-releases
permissions:
contents: write
runs-on: ubuntu-latest
if: ${{ needs.check-releases.outputs.comparison == '<' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "master"

- name: Remove leading 'v' from version numbers
run: |
FIREBASE_ACTIONS_RELEASE=${{ needs.check-releases.outputs.firebase-actions-release }}
FIREBASE_TOOLS_RELEASE=${{ needs.check-releases.outputs.firebase-tools-release }}
echo "FIREBASE_ACTIONS_RELEASE=${FIREBASE_ACTIONS_RELEASE#v}" >> $GITHUB_ENV
echo "FIREBASE_TOOLS_RELEASE=${FIREBASE_TOOLS_RELEASE#v}" >> $GITHUB_ENV
- name: Bump version
id: bump-version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ env.FIREBASE_ACTIONS_RELEASE }}"
replace: "${{ env.FIREBASE_TOOLS_RELEASE }}"
include: "{Dockerfile,action.yaml}"
regex: false

- name: Commit & Push changes
if: ${{ steps.bump-version.outputs.modifiedFiles > 0 }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Bump firebase-tools to ${{ needs.check-releases.outputs.firebase-tools-release }}"
git tag -a ${{ needs.check-releases.outputs.firebase-tools-release }} -m "Bump firebase-tools to ${{ needs.check-releases.outputs.firebase-tools-release }}"
git push origin HEAD:master --tags
- name: Create Release
id: create_release
uses: comnoco/create-release-action@v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.check-releases.outputs.firebase-tools-release }}
release_name: firebase-tools ${{ needs.check-releases.outputs.firebase-tools-release }}
body: "Bump `firebase-tools` to ${{ needs.check-releases.outputs.firebase-tools-release }}"
draft: false
prerelease: false
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:18.18.2-buster

LABEL version="12.8.0"
LABEL version="13.0.1"
LABEL repository="https://github.com/w9jds/firebase-action"
LABEL homepage="https://github.com/w9jds/firebase-action"
LABEL maintainer="Jeremy Shore <w9jds@github.com>"
Expand All @@ -13,7 +13,7 @@ LABEL com.github.actions.color="gray-dark"
RUN apt update && apt-get install --no-install-recommends -y jq openjdk-11-jre && rm -rf /var/lib/apt/lists/*

RUN npm i -g npm@8.10.0 && npm cache clean --force
RUN npm i -g firebase-tools@12.8.0 && npm cache clean --force
RUN npm i -g firebase-tools@13.0.1 && npm cache clean --force

COPY LICENSE README.md /
COPY "entrypoint.sh" "/entrypoint.sh"
Expand Down
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ outputs:

runs:
using: "docker"
image: "docker://w9jds/firebase-action:v12.8.0"
image: "docker://w9jds/firebase-action:v13.0.1"

0 comments on commit b3f64e0

Please sign in to comment.