parse string env to int #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Staging Build and Deploy | |
on: | |
push: | |
branches: ["dev"] | |
jobs: | |
build-and-push: | |
name: Build and Push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get Unix Time | |
id: timestamp | |
run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT | |
- name: Get SHA | |
id: sha | |
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set Image Tag | |
id: itag | |
run: echo "itag=latest" >> $GITHUB_OUTPUT | |
- name: Set Image Name | |
id: iname | |
run: echo "iname=firstbatch/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT | |
- name: Remove unnecessary files # https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930 | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver: docker-container | |
- name: Build and Push Contaimer Image | |
env: | |
IMAGE_NAME: ${{ steps.iname.outputs.iname }} | |
IMAGE_TAG: ${{ steps.itag.outputs.itag }} | |
run: | | |
docker buildx create --use --name ibuilder --driver docker-container | |
docker buildx build --platform linux/arm64 --builder=ibuilder -t $IMAGE_NAME:$IMAGE_TAG --load . | |
docker push $IMAGE_NAME:$IMAGE_TAG | |
docker rmi $IMAGE_NAME:$IMAGE_TAG | |
outputs: | |
itag: ${{ steps.itag.outputs.itag }} | |
iname: ${{ steps.iname.outputs.iname }} |